|
Hi there,
I am new in C#,
I am writing a C# application , I need it to be a program that must be installed after that it should start running ones the windows starts up, even before login .
what are the steps can I make so my application be installed by the user
and then how can I make it run before log on windows
Thanks
There is always something to learn
|
|
|
|
|
To run before login, the application must be a Windows Service. That's one of the project types in Visual Studio so your first step is to create your app as a service. You then need to add a service installer so that it can be installed in the service manager.
|
|
|
|
|
Thank you,
but I am not very familiar with the windows services ,
so would mind sending me resources that I can learn how to build a service
and how to deal with the service installer
There is always something to learn
|
|
|
|
|
|
hi again,
thank you very much for the help,
after building my service before the login to the windows , I want to make sure that the service really works , and I was wondering if there is a way to make the service to perform the login to a specific user account ,
if there is such a way, would please send me back
or guide me where to find kind of tutorials about the windows(operating System) functions and what possible things I can let may C# windows service do.
thanks
There is always something to learn
|
|
|
|
|
Is anyone able to help me get this to work? Im not that familiar with the Windows API and have been fiddling around with this for days
<br />
using System;<br />
using System.Runtime.InteropServices;<br />
<br />
namespace System<br />
{<br />
public class WorkingArea<br />
{<br />
[DllImport("user32.dll", CharSet=CharSet.Auto, SetLastError=true)]<br />
[return:MarshalAs(UnmanagedType.Bool)]<br />
public static extern bool SendMessageTimeout(IntPtr hWnd,int Msg,string lParam,int uTimeout,int lpdwResult);<br />
<br />
public struct RECT<br />
{<br />
public int Left;<br />
public int Top;<br />
public int Right;<br />
public int Bottom;<br />
}<br />
[DllImport("User32.dll", EntryPoint = "SystemParametersInfoA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]<br />
private static extern short SystemParametersInfo(short uAction, short uparam, ref RECT lpvParam, short fuWinIni);<br />
[DllImport("user32", EntryPoint = "PostMessageA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]<br />
private static extern int PostMessage(int hwnd, int wMsg, int wParam, ref int lParam);<br />
<br />
<br />
public const int HWND_BROADCAST = 0xffff;<br />
public const int WM_SETTINGCHANGE = 0x001A;<br />
public const int SMTO_NORMAL = 0x0000;<br />
public const int SMTO_BLOCK = 0x0001;<br />
public const int SMTO_ABORTIFHUNG = 0x0002;<br />
public const int SMTO_NOTIMEOUTIFNOTHUNG = 0x0008;<br />
public const int SPIF_SENDCHANGE = 0x02;<br />
public const short SPI_SETWORKAREA = 47;<br />
<br />
public void SetWorkArea(RECT rect)<br />
{<br />
SystemParametersInfo(SPI_SETWORKAREA, 0,ref rect, SPIF_SENDCHANGE);<br />
}<br />
}<br />
}
ie.
WorkingArea WorkSpace = new WorkingArea();<br />
RECT Area = new WorkingArea.RECT();<br />
Area.Left=25;<br />
Area.Top=25;<br />
Area.Bottom=25;<br />
Area.Right=25;<br />
WorkSpace.SetWorkArea(Area);
------------------------
|
|
|
|
|
I'm writing a small application at work (programming isn't my primary job function at the moment). I'm using Access to keep track of some information...it's mostly static. At the moment the application and the access database reside on a network share because a few people in my department need to access it. However, I'm using ReportViewer in Visual Studio 2008 and the ReportViewer dlls aren't installed on any of our office machines. If I stick the dlls on the network share they're aren't recognized. I don't have administrative rights to install them on each machine. My thoughts are to zip on up the application and put it on each machine with the dlls files included.
However, the access database needs to remain on the network share so that each user only accesses the one copy of the database. I'm planning on leaving the company in a couple months and no one in my department knows C#. If the network share's URI changes in the future, the application will break. Are they any suggestions for a way to have users be able to change the URI within the application and if it use that URI in the future if for some reason it changed? I want to make it as easy as possible for some of the folks here. I'd rather not have to come back and fix the application in the future just because they decide they need to restructure every year.
|
|
|
|
|
Hi everyone,
I am developing for my company a project management system using C# / .NET and MVP pattern. Now I encouter the following design problem:
- I have a project selector GUI containing the list of all available projects where the user can choose one or several project(s) like this:
---------
Please choose one or several projects:
Project 1
Project 2
Project 3
....
Project n
[Open button]
----------
- After choosing one or several projects, a tab appears displaying all project names and the project structure in tree form of the currently tabed-active project is displayed. The project tree consists of working packages and workitems while working packages can in turns contain work items or working items itself (composit pattern), something like this
Project 1
---Kick off phase
---Specification analyze
---- Analyze A
-----Analyze B
---Implementation
.....
The user can click on the item in the project tree have the detailed information displayed, e.g. detailed information of the current project when the root node (Project 1 above) is selected or of working package when a working package node is selected and of work item when a work item is selected.
My question is: how to model all that stuffs in MVP pattern. I guess it would make sence to have a MVP triad like ProjectStructureView - ProjectStructurePresenter - ProjectStructureModel. But should I have each MVP triad for each kind of project item in the tree (project, package, workitem) ?
The fact is, all the displayed information for the current project has only to do with project.
So the other question is: what should be stored in for example ProjectStructureModel?
Your answer would be really appreciated!
Regards.
|
|
|
|
|
Quang Tran Minh wrote: My question is: how to model all that stuffs in MVP pattern.
See Model[^]
See Design[^]
Quang Tran Minh wrote: So the other question is: what should be stored in for example ProjectStructureModel?
See Data Model[^]
led mike
|
|
|
|
|
|
papadimitriou wrote: that was a very cynical answer.
cynical?
led mike
|
|
|
|
|
Hi led mike and papadimitriou,
thanks for your reply. In fact I've read many available papers, tutorials about MVP patter include some of your suggested ones. My question goes directly to this particular project.
The root of the project structure tree is the project itself. The root has a list of sub items that are either a working package that can in turns has a list of sub items (working package or work item) or a work item (leaf node). In my implementation, composite pattern is used to model this:
class abstract ProjectElement
class Project: ProjectElement
{
List<projectelement> subItems;
}
class Package: Project
{
List<projectelement> subItems;
}
class WorkItem: Project
{
}
inspirated from some articles about Presenter first method by mean of thinking in "When" , my thoughts are:
- When the user opens a project, he sees the projecture structure => aha MVP triad ProjectStructureView-ProjectStructurePresenter-ProjectStructureModel
- When the user clicks on an item (which can be either project, package or workitem like explained above) an editor dialog is displayed showing the detailed information of the currently selected node (again project, package or workitem). The user can edit / change these information => MVP triad: ProjectElementEditorView-ProjectElementEditorPresenter-ProjectElementEditorModel. I am stuck at this point: the ProjectElementEditor is an abstract concept (abstract class) which can be either project, package or workitem. My question would be:
Does the MVP triad ProjectElementEditorView-ProjectElementEditorPresenter-ProjectElementEditorModel make sence? Then the ProjectElementEditorPresenter would has an generic interface to a ProjectElementEditorView (which can be either Project general information editor, package information editor or workitem information editor) or should I define for each type of view a MVP triad like:
ProjectGeneralInfoEditorView - ProjectGeneralInfoEditorPresenter-ProjectGeneralInfoEditorModel
PackageInfoEditorView - PackageEditorPresenter-PackageEditorModel
WorkItemEditorView - WorkItemEditorPresenter-WorkItemEditorModel
Hope it makes the problem clearer
|
|
|
|
|
Quang Tran Minh wrote: an editor dialog is displayed showing the detailed information of the currently selected node
dialogs are from Windows 3.0 User Interfaces. Today you can do things like have a splitter so you can present your navigation in one splitter pane and a different view, say for editing, in the other.
Also for .NET applications the PropertyGrid works brilliantly for an editor mechanism
Quang Tran Minh wrote: When the user clicks on an item (which can be either project, package or workitem like explained above)...
The Properties of the item are displayed in the PropertyGrid
led mike
|
|
|
|
|
Hello
I've a DataGridView populated with a query
The user can add some rows
The primary key is auto increment and not visible
But some oter fiels can not be duplicated
What is the best way to check them befor to do the update
do I have to make a query in the db for each of those fields before to validate the user entry ?
Any suggestion is welcome
|
|
|
|
|
baranils wrote: But some oter fiels can not be duplicated
Do you mean you created a unique index on the field in MySql?
led mike
|
|
|
|
|
Hello !
Not yet
The table contain one auto-increment primary key and a few fields
2 of those fields can't be duplicated because they are alternate identifier for the entity
For now I didn't aplly any index on those fields but I'm looking for the best way to manage them, using MySql ADO and C#
Thank you for your reply !
|
|
|
|
|
baranils wrote: but I'm looking for the best way to manage them
Well I'm no database expert but it's possible that creating unique indexes in the database is the best practice approach or at least the first step.
led mike
|
|
|
|
|
You have to specify IN THE DATABASE that a given column must be unique.
If your database already contains data, make sure that none of the data in that column is a duplicate BEFORE setting the column to be unique.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi all,
Can you please assist me with any relevant code in Csharp/ASp.net that helps me reading a CSV file off an Ftp site and populate a table in my database.
Thank you very much.
|
|
|
|
|
Check out ye olde FtpWebRequest class, its like HttpWebRequest, but for FTP instead. What you end up with is a stream to the file, then you can read it like you would any other stream.
My current favourite word is: Nipple!
-SK Genius
|
|
|
|
|
Thank you very much.Your help is much appreciated.
Can you please give me a little more tips please?
Thank you.
|
|
|
|
|
|
Hi all. How i can make control reflect changes was maded on his datasource?
<br />
ctlTextEdit.DataBindings.Add(new Binding("EditValue", _mySourceDataRow, "Field1"));<br />
<br />
....<br />
<br />
void someButton_onClick(...)<br />
{<br />
_mySourceDataRow.Field1 = "New text";<br />
<br />
} <br />
<br />
Or exists an method in Form class what make all child controls reread values from ones data sources?
THANK.
|
|
|
|
|
|
I'm looking for more efficient Xml reading. I do not mean performance - I load small files. I'd rather ask about coding style/methods. Now I use the following routine:
public static void FromFile(string path, KorepetytorMenu menu)
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(path);
foreach (XmlNode rootNode in xmlDoc.ChildNodes) {
XmlElement rootEl = rootNode as XmlElement;
if (rootEl != null && rootEl.Name == "KorepetytorMenu") {
foreach (XmlNode node in rootEl.ChildNodes) {
XmlElement el = node as XmlElement;
if (el != null && el.Name == "RootNode") {
menu.rootNode = KorepetytorMenuNode.FromXmlElement(el);
ReadNodeChildsRecursive(menu.rootNode, el);
}
}
}
}
}
I just have been starting coding this, but I wrote some programs like this in the past and I know that it gets annoying when there are 10 or more nested foreach'es an if's.
A sample Xml file:
<?xml version="1.0" encoding="utf-8" ?>
<KorepetytorMenu>
<RootNode Header="" Image="">
<Node Header="Fizyka">
<Node Header="Równania Rózniczkowe" Image="Gwiazdka.png" />
<Node Header="Kinematyka 1" File="Matma\Równania Rózniczkowe.xml" />
(...)
</Node>
</RootNode>
</KorepetytorMenu>
Any ideas?
Thanks in advance.
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|