|
Then do i have to create the console application instead of windows application to launch through service.
Khan
|
|
|
|
|
No. A Console app is also a UI app - not a GUI, but a UI. Services cannot interact with the desktop, or initiate any interaction - because they can be running before a user has logged in, so there is no user to interact with!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
the app which is running at the backend through service doesn't have any user interaction. It just connect to database and run some procedures, get some rows from database and send mails to the participants.
Please suggest how to do that.
Khan
|
|
|
|
|
Make it a service as well...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
You mean instead of creating another external exe whole code has to be written in service itself.
what i understood correct?
Khan
|
|
|
|
|
I have written all code of backend.exe file into service and it is working fine now. thanks a lot
Khan
|
|
|
|
|
You're welcome!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
The comments about the UI in the other sub-thread, as far as I can tell, have no relevance to the code posted.
Presumably your log messages are showing up. Your code appears to be correctly handling potential exceptions HOWEVER you should log the stack trace also.
Finally, as to your problem...
Far as I can tell you do not seem to be actually starting the timer.
If true then what will happen is that your OnStart method will exit, which means no threads will be running in the service. Windows knows that threads are running and will not mark it as running unless one thread is running.
|
|
|
|
|
Any idea how to include thread in this service and backend.exe application
Khan
|
|
|
|
|
There are several ways. Your code is already mostly there except you are not starting the timer.
|
|
|
|
|
Looks like you're using Oracle.
In SQL Server, one just adds a (console) app to the server, and has it run on a schedule using SQL Server Agent. Easy.
One would think that Oracle has something similar. Or use the Windows Task Scheduler.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
I'm searching for a good unit testing and mocking framework for C# (not necessarily open source).
Any suggestions?
|
|
|
|
|
I used to use nunit. Used to only because I haven't done any C# for a while. As long as it is being maintained I presume it is very usable.
I didn't use mocks then but googling certainly suggest that they exist.
|
|
|
|
|
For mocking, I love JustMock from Telerik. It allows you to mock things that other mocking frameworks just can't cope with.
This space for rent
|
|
|
|
|
|
How how can I download a PDF from PDF drive.net programmatically????
|
|
|
|
|
You will not get any help from this site to download illegally copied files: and that is exactly what the site you reference specializes in. The files it contains are copyrighted to the various authors and publishers and are effectively stolen.
Since we have many book authors here - and even more of us write technical documents and know exactly how hard it is to do - downloading books from illegal sites is not something we wish to be associated with.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hi everybody
I have a DataGrid control for which one of the columns consists in ComboBox controls defined in a DataTemplate (refer to the xaml snippet below).
The ComboBox controls are populated through data binding and everything works fine.
My problem: I would like to disable (from code behind) the selected ComboBox control item as long as the treatment associated to that selection is not complete.
Any idea, comment, suggestion?
Here is the xaml snippet:
<datagrid name="onGoingActionsGrid" autogeneratecolumns="False" background="Transparent" borderbrush="Transparent"
="" canuseraddrows="False" canuserdeleterows="False" canuserresizerows="False" canuserresizecolumns="False">
<datagrid.columns>
<datagridtextcolumn header="Actions" width="235" binding="{Binding Name}">
<datagridtemplatecolumn header="State" isreadonly="True" width="40">
<datagridtemplatecolumn.celltemplate>
<datatemplate>
<datagridtemplatecolumn header="Control" width="50">
<datagridtemplatecolumn.celltemplate>
<datatemplate>
<combobox x:name="ControlActionComboBox"
="" itemssource="{Binding CollectionOfPictograms, Mode=TwoWay}" selectionchanged="controlAction_SelectionChanged" selecteditem="{Binding SelectedItem, Mode=TwoWay}" selectedvaluepath="Content">
<combobox.itemcontainerstyle>
<Setter Property="Padding" Value="4.3"/>
<Setter Property="BorderBrush" Value="LightGray"/>
<Setter Property="BorderThickness" Value="1"/>
<combobox.itemtemplate>
<datatemplate>
<dockpanel>
|
|
|
|
|
You said you want to "disable" the combo box "item" ...
You can't disable "items"; you can only handle / not handle them explicitly.
As for "controls", add a bool "Enabled" property to the code-behind / view-model that has GET logic related the treatment and is bound to the .IsEnabled property of the control (i.e. combo) in the XAML.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
(You should respond in the forums so everyone can see your answer).
Set the “IsEnabled” on the “combo box” in the XAML; not in the “item container” style.
Each “row” / item has it's own combo box (in this case).
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp2
{
class Program
{
static void Main(string[] args)
{
double wip;
double hii;
double bmi;
Console.Write("Eneter Weight in pounds:");
wip = Double.Parse(Console.ReadLine());
Console.Write("Enter height in inches:");
hii = Double.Parse(Console.ReadLine());
bmi = wip * 703 / Math.Pow(hii, 2);
Console.WriteLine($"bmi is: {bmi}");
Console.ReadLine();
if (bmi > 18.50)
{
Console.WriteLine("You are under weight.");
}
else if (bmi >= 24.9)
{
Console.WriteLine("Your weight is normal.");
}
else if (bmi > 30)
{
Console.WriteLine("You are obse.");
}
}
}
}
|
|
|
|
|
The BMI classification is defined like this:
- Underweight = <18.5
- Normal weight = 18.5-24.9
- Overweight = 25-29.9
- Obesity = >=30
(Source: Calculate Your BMI - Metric BMI Calculator[^])
To write that in your code, you can do this:
if (bmi < 18.5)
{
}
else if (bmi < 25)
{
}
else if (bmi < 30)
{
}
else
{
}
The quick brown ProgramFOX jumps right over the Lazy<Dog> .
|
|
|
|
|
C# program and the client is running it on a server. It is installed on the remote server and it is accessed by different user under different accounts. It was written to be installed on the same computer that it is run from but I just found out the client installed it on a server. It appears that all the users are sharing the same user.config file. Could someone explain to me how the config files work when a .net program is run on a server? I need to fix it so it can be run either from the server or from a workstation. Could someone either point me to the right place to look I am either searching using the wrong words or explain to me what happens with the config files when you run from a server. I'm currently using the settings.settings built into C#
|
|
|
|
|
The processing of config files does not change if the app is running on the server version of Windows.
You have to find out HOW they are running your app on the server. For example, are they running the app under Remote Desktop? Terminal Services? Citrix? Or something similar? What's the configuration of the application objects in whatever sharing app they're using your app under.
Either they are going to change the configuration of the server and whatever app/desktop sharing they're using or your app would have to be modified to support running under these systems successfully.
System.ItDidntWorkException: Something didn't work as expected.
-- said no compiler, ever.
C# - How to debug code[ ^].
Seriously, go read this article.
Dave Kreskowiak
|
|
|
|
|