Exemple #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            setting = new AppSetting();
            string AppMode = setting.ReadApplicationMode();

            if (string.IsNullOrEmpty(AppMode))
            {
                StartupConfig.CreateInstance().AppMode = AppMode;
                Application.Run(new frmStratup(setting));
            }
            else
            {
                if (AppMode == "SERVER")
                {
                    Server.ServerStartupForm obj = new Server.ServerStartupForm();
                    Application.Run(obj);
                }
                else
                {
                    Client.ClentStartupFrom obj = new Client.ClentStartupFrom();
                    Application.Run(obj);
                }
            }
        }
Exemple #2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            var ConfigInstance = StartupConfig.CreateInstance();

            if (string.IsNullOrEmpty(ConfigInstance.AppMode))
            {
                if (!string.IsNullOrEmpty(cmbMode.GetItemText(cmbMode.SelectedItem)) && cmbMode.GetItemText(cmbMode.SelectedItem) != "SELECT")
                {
                    ConfigInstance.AppMode = cmbMode.GetItemText(cmbMode.SelectedItem);
                    this.Close();
                    if (ConfigInstance.AppMode == "SERVER")
                    {
                        Server.ServerStartupForm obj = new Server.ServerStartupForm();
                        obj.Show();
                    }
                    else if (ConfigInstance.AppMode == "CLIENT")
                    {
                        Client.ClentStartupFrom obj = new Client.ClentStartupFrom();
                        obj.Show();
                    }
                    setting.WriteApplicationMode(ConfigInstance.AppMode);
                }
            }
        }