コード例 #1
0
ファイル: wfrm_Tray.cs プロジェクト: dioptre/nkd
        /// <summary>
        /// Default constructor.
        /// </summary>
        public wfrm_Tray()
        {
            InitUI();

            m_pMailServer = new Server();

            Start();
        }
コード例 #2
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="server">Server what owns this virtual server.</param>
 /// <param name="id">Virtual server ID.</param>
 /// <param name="name">Virtual server name.</param>
 /// <param name="apiInitString">Virtual server api initi string.</param>
 /// <param name="api">Virtual server API.</param>
 public VirtualServer(Server server,string id,string name,string apiInitString,IMailServerApi api)
 {
     m_pOwnerServer  = server;
     m_ID            = id;
     m_Name          = name;
     m_ApiInitString = apiInitString;
     m_pApi          = api;
 }
コード例 #3
0
ファイル: wfrm_Tray.cs プロジェクト: dioptre/nkd
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose(bool disposing)
		{
            if(m_pMailServer != null){
			    m_pMailServer.Dispose();
                m_pMailServer = null;
            }
            if(m_pNotyfyIcon != null){
                m_pNotyfyIcon.Dispose();
                m_pNotyfyIcon = null;
            }
            			
			base.Dispose(disposing);
		}
コード例 #4
0
ファイル: MainX.cs プロジェクト: dioptre/nkd
		/// <summary>
		/// Application main entry point.
		/// </summary>
		/// <param name="args">Command line argumnets.</param>
		public static void Main(string[] args)
		{
            // Add app domain unhandled exception handler.
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
                                                
			if(args.Length > 0){
				if(args[0].ToLower() == "/?" || args[0].ToLower() == "/h"){                    
					string text = "";
					text += "Possible keys:\r\n";
					text += "\r\n";
                    text += "\t -daemon, runs server as daemon application.\r\n";
					text += "\t -trayapp, runs server as Windows tray application.\r\n";
					text += "\t -winform, runs server in Windows Forms window.\r\n";
					                    					
                    System.Windows.Forms.MessageBox.Show(null,text,"Info:",System.Windows.Forms.MessageBoxButtons.OK,System.Windows.Forms.MessageBoxIcon.Information);
				} 
                else if(args[0].ToLower() == "-daemon"){
                    Server server = new Server();

                    while(true){
                        System.Threading.Thread.Sleep(1);
                    }
                }
				else if(args[0].ToLower() == "-trayapp"){                    
                    System.Windows.Forms.Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
                    System.Windows.Forms.Application.EnableVisualStyles();
					System.Windows.Forms.Application.Run(new wfrm_Tray());
				}
                else if(args[0].ToLower() == "-winform"){                    
                    System.Windows.Forms.Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
                    System.Windows.Forms.Application.EnableVisualStyles();
					System.Windows.Forms.Application.Run(new wfrm_WinForm());
				}
                else{
                    System.Windows.Forms.MessageBox.Show("Invalid command line argument was specified ! (try /? or /h for help)","Error:",System.Windows.Forms.MessageBoxButtons.OK,System.Windows.Forms.MessageBoxIcon.Error);
                }
			}
			else{
                // Choose right version SQL-Lite.
                try{
                    try{
                        File.Delete(System.Windows.Forms.Application.StartupPath + "\\System.Data.SQLite.dll");

                        // x64
                        if(IntPtr.Size == 8){
                            File.Copy(System.Windows.Forms.Application.StartupPath + "\\System.Data.SQLite.x64.dll",System.Windows.Forms.Application.StartupPath + "\\System.Data.SQLite.DLL");
                        }
                        // x32
                        else{
                            File.Copy(System.Windows.Forms.Application.StartupPath + "\\System.Data.SQLite.x32.dll",System.Windows.Forms.Application.StartupPath + "\\System.Data.SQLite.DLL");
                        }
                    }
                    catch{
                        // We dont care File does not exist or in use errors here.
                    }                    
                }
                catch(Exception x){
                    System.Windows.Forms.MessageBox.Show("Error: " + x.ToString(),"Error:",System.Windows.Forms.MessageBoxButtons.OK,System.Windows.Forms.MessageBoxIcon.Error);
                }

                System.Windows.Forms.Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
                System.Windows.Forms.Application.EnableVisualStyles();
                System.Windows.Forms.Application.Run(new wfrm_Install());
			}
        }
コード例 #5
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        public MailServer_Service()
        {
            m_pServer = new Server();

            this.ServiceName = "LumiSoft Mail Server";
        }