|
I second Eddy's suggestions, and do feel free to ask questions in this forum and people will try their best to answer them
Language-wise, I prefer C# since I came from a C++/Java background before coming over to .Net and the transition was fairly smooth.
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Jeffrey Richter's CLR via C# is book for you.
|
|
|
|
|
thank you very much! That is the book I am looking for!
|
|
|
|
|
|
Hello friends,
I need a help ,i want to open a windows application when my window service starts.i have done with my window service and with the application too.Bt i just want to open window application using window service.Can anyone please help me that how can i link both the applications and where do i put the code in window service to open window application and what code i have to write to open my window application when window service starts.
Thx in advance.
reply me fast its urgent..
Bhanu Madan
|
|
|
|
|
|
|
madanbhanu wrote: ,i want to open a windows application when my window service starts
Stop right there. No, you don't
Services do not expose any kind of user interface at all. They also do not launch applications on the desktop when a user logs in. Why? Because it's horrible practice that MS is trying to disuade for good reason, security being the top one.
If you run your service on Windows XP, sure, it can launch an app on the user Desktop. But, do that exact same thing on Vista or 7 and the user won't see anything at all. They'll get a notification that "A service is requesting your attention. Do you want to switch to the alternate desktop to see this interface?" or something to that effect.
Since you're asking all of these basic questions about what code to put in a service where, it's obvious you have no idea what services do or how they work. I'd start by just trying to get a service app compiled and installed. Don't worry about showing anything because they really should (and can't) show any user interface at all.
and finally... Nobody cares how URGENT you think your question is. It's very unacceptable to request really fast relies to your posts because you're not paying for any service agreement and all the questions here are answered by people who volunteer their spare time doing so and reply when they can, not when you demand.
|
|
|
|
|
hello Dave first of all thanx so mch for all dis and secondly i am new at windows so dat's why i don't know mch about windows services.See friend if this is not posssible to open an application in windows services then please send me the alternate way.for example,can i start my windows application as window services.I just want to do to show the pop up with a message on my taskbar.how can i do this with window services.
Hope this tym u get it ...
n thanks again
Bhanu madan
|
|
|
|
|
madanbhanu wrote: .See friend if this is not posssible to open an application in windows services then please send me the alternate way.
My "friend", there is no alternative way; a windows service is something that does not interact with the user. At all.
madanbhanu wrote: I just want to do to show the pop up with a message on my taskbar.
Follow the demo in the documentation[^].
madanbhanu wrote: <layer>.how can i do this with window services.
You don't; you create a normal app, start it when the user logs in. A Windows Service is started when the computer starts, and runs before you logon to Windows - there IS NO TASKBAR on that logon-screen.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
The only way to do what you want is to write two programs that talk to each other. The first is your Windows Service app. It'll open some communication channel, like a Named Pipe, that it uses to talk to any application that wants to listen.
The second is a Windows Application, that starts from the Run key when a user logs in, and listens to the communication channel that the service starts. When it hears a message that the service sends it takes appropriate action, like putting up a MessageBox.
Forget the Task Bar notification for now. You've got enough to worry about without that.
|
|
|
|
|
No, again: the service does not start an application on a user desktop. Get away from that wrong concept! URGENTZ!
Rather look again at the functionality from the user's point of view: he'll see an icon in the system tray, with some messages popping up. That icon belongs to an application which is started when the user logs in. You can achieve that by putting a link to that application to the start-up folder.
|
|
|
|
|
Why do you even need a service? Why not just write an application that uses the SystemTray and is started up automatically when the user logs in?
See this[^] example for creating a sys tray application.
If there's a shortcut to your application in the Startup folder, your application will run automatically.
|
|
|
|
|
I am currently learning WPF and require some assistance in understanding some main concepts...
My XAML contains numerous GUI elements, one being a DataGrid called 'dataGrid1'
The DataGrid is populated in the main window using the following code fragment:
MyDataGrid gridData = new MyDataGrid();
gridData.PopulateData();
dataGrid1.DataContext = gridData.dt;
MyDataGrid is a class that is composed of a DataTable exposed through dt. PopulateData() performs a LINQ query on an EF context.
The code above works fine and the grid shows the query results.
What if I wanted to create a class which derives from DataGrid. How would such a class be accessible/linked/represented in the XAML?
A reader from Montreal, Canada
|
|
|
|
|
WPF allows a lot of customisation to be done without needing to use inheritance, what is it you are wanting to achieve by inheriting from the DataGrid? If you decide you just want to in herit from the DataGrid anyway, a good point to start your research would be some research on DependencyProperties. If you want to add behaviour with out inheriting a good starting point would be understanding AttachedProperties.
|
|
|
|
|
Thank-you for the reply.
For the purpose of having the DataGrid events exist within the MyDataGrid object rather than my main window. Would this be a bad approach?
|
|
|
|
|
If it is just one dataGrid used one time then generally speaking inheritance is not the best way to approach this. Although it is not the only way by any means to work with WPF, the MVVM design is very popular. If you have a set of requirements of what you are looking for your grid to do I will take a look and see if i can provide you with some sample code to get you started. One of the general principles of MVVM is seperating any code that involves your Data from the User Interface, using MVVM i find that it is quite rare that i am using EventHandlers for UI components.
If you are just looking to seperate out your event handlers you could do something like this:
public class MyWindow:Window
{
private MyDataCollection _gridData;
public MyWindow()
{
InitializeComponent();
_gridData = new MyDataCollection();
DataGrid1.RowAdded += _gridData.DataRowAdded;
}
}
public class MyDataCollection
{
public void DataRowAdded(object sender, EventArgs e)
{
}
}
I'm not saying the above code would be the right solution but you would not be inheriting a control you proabably don't need to if you are just aiming to seperate your Event Handling Code from your Window Code.
|
|
|
|
|
Sorry for the late reply. I was away from home the last 3 days.
Yes, I was thinking on the line of something like this.
For the moment, until I study recommended practices and patterns, this is not important.
There is one item that is bothering me though.
Why is it that when a given grid row is selected via code, the background is not highlighted in the same manner as when selecting the row via a mouse click.
For instance:
dataGrid1.SelectedIndex = 0;
The background row is highlighted in a light-grey color.
But clicking the row, the row is highlighted in blue.
I've determined this is a focus issue. If the grid is forced to have the focus, the row is highlighted blue. If it loses focus, it changes to grey.
In my particular case, it would be great to maintain the blue background on the row even if focus is lost. What would be the best way to do this?
modified 6-Aug-12 15:20pm.
|
|
|
|
|
try this.
Note this should be added inside the following xaml node:
<DataGrid>
<DataGrid.Resources>
<Style TargetType="{x:Type DataGridCell}">
<Style.Triggers>
<Style.Triggers>
</Style>
</DataGrid.Resources>
</DataGrid>
|
|
|
|
|
I placed a trigger on property IsSelected.
Works fine.
Thank-you.
|
|
|
|
|
Ed,
Would you be able to provide some guidance to this problem:
I have a DataGrid which is bound to a DataTable.
Relevant XAML & code ('<' intentionally left off at start of each line):
DataGrid Name="dataGrid1" IsReadOnly="True" ItemsSource="{Binding}"
DataGrid.Columns>
DataGridTextColumn Header="Name" Binding="{Binding Path=Name}" />
DataGridTextColumn Header="Path" Binding="{Binding Path=Path}" />
/DataGrid.Columns>
dataGrid1.DataContext = gridData.dt; // this is a DataTable with 3 columns.
The 3rd dt column is not shown on the grid.
The data table is sorted on the first column and contents are displayed.
The user can sort on either of Name or Path columns/headings by clicking on them.
My question, what is the best approach to update the grid data upon a user sorting on one of the columns? (This requires sorting the DataTable once again on the proper column)
This is what I have observed:
1. Adding a Click event handler on DataGridColumnHeader does fire the event.
I have observed that the value of columnHeader.SortDirection (in sender) is the
CURRENT value, not the target value. Is it correct to say that a given column
sort order goes through these phases:
null --> ascending
descending --> ascending
ascending to descending
I.E. By knowing the current state, the next state is determinable.
2. I can place a trigger in the DataGridColumnHeader's SortDirection property looking for Ascendiing/Descending/null but then what? Can I execute code against this?
If so, can you show me a code fragment.
Your thought on the above 2 approaches.
Furthermore, what is the proper way of solving this issue in your opinion?
Thank-you.
|
|
|
|
|
I'm afraid i have no experience with sorting on Grids, for most grids in the applications i work on we use a paid for grid component that handles the sorting for us. I'll have a quick look to see if i can figure out what you are after but i'd recommend you create a new post in the WPF forum with this question.
|
|
|
|
|
Ok had a little look at this, have you tried the following
<DataGrid Name="dataGrid1" IsReadOnly="True" ItemsSource="{Binding}" CanUserSortColumns="True">
<DataGrid.Columns>
<DataGridTextColumn Header="Name" Binding="{Binding Path=Name}" />
<DataGridTextColumn Header="Path" Binding="{Binding Path=Path}" />
</DataGrid.Columns>
</DataGrid>
For me adding the CanUserSortColumns="True" to the grid properties was enough to get sorting working, unless you need something more than visual sorting this should work for you.
|
|
|
|
|
Ed,
This sorts the columns visually but the DataTable data bound to the grid is not sorted.
Thank-you for your reply, I'll open a new subject.
|
|
|
|
|
I am trying to get a COM component properties. VS2010 shows the Dynamic Properties, but I can not figure out how to get them. Reflection always gives me an empty array of properties.
Can somebody help me?
thanks.
Bob Jiang
|
|
|
|