예제 #1
0
        private void 参数设置ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SettingForm setForm = new SettingForm();

            setForm.processSpec = processSpec;
            setForm.ShowDialog();
        }
예제 #2
0
        public JsonResult SaveModel(SettingForm form)
        {
            SaveReturn saveReturn = new SaveReturn();

            if (form == null)
            { // sanity check, shouldn't happen
                saveReturn.Messages.Add(new SaveMessage(SaveMessageType.Error,
                                                        SaveMessageDelivery.MessageLine,
                                                        "Data error, value is null"));
            }

            if (!saveReturn.HasErrors)
            {
                Setting model;

                if (form.SettingId == 0)
                { // new category
                    model = new Setting();
                    BindFormToDbModel(form, model, saveReturn);
                    if (!saveReturn.HasErrors)
                    {
                        model.CreatedByUserId = model.ChangedByUserId;
                        model.CreatedDttm     = model.ChangedDttm;
                        db.Settings.Add(model);
                        try
                        {
                            db.SaveChanges();
                        }
                        catch (Exception ex)
                        {
                            if (IsDuplicateKey(ex)) //%% this is only needed if there's a unique key on the table.
                            {
                                //%% display a message that tells the user what the duplicate field is
                                saveReturn.Messages.Add(new SaveMessage(SaveMessageType.Error,
                                                                        SaveMessageDelivery.MessageLine,
                                                                        "Duplicate setting value"));
                            }
                            else
                            {
                                throw;
                            }
                        }
                    }
                }
                else
                { // existing
                    model = db.Settings.Where(r => r.SettingId == form.SettingId).SingleOrDefault();
                    BindFormToDbModel(form, model, saveReturn);
                    if (!saveReturn.HasErrors)
                    {
                        db.SaveChanges();
                    }
                }
                if (!saveReturn.HasErrors)
                {
                    saveReturn.Model = model; // model to re-display
                }
            }
            return(Json(saveReturn));
        }
예제 #3
0
        private void CDMSForm_Shown(object sender, EventArgs e)
        {
            #region old
            //try
            //{
            //    GT:
            //    MssBox.iWaitForm(splashScreenManager1);
            //    string HostDB = Properties.Settings.Default.Host;
            //    string DBName = Properties.Settings.Default.DBName;
            //    string User = Properties.Settings.Default.Username;
            //    string Pass = OneSecurity.Decryption(Properties.Settings.Default.Password);

            //    var ConStr = new System.Data.SqlClient.SqlConnectionStringBuilder()
            //    {
            //        DataSource = HostDB,
            //        InitialCatalog = DBName,
            //        UserID = User,
            //        Password = Pass,
            //        PersistSecurityInfo = true,
            //    }.ConnectionString;

            //    Program.conStr = ConStr;

            //    try
            //    {
            //        var condb = new CDMSDBDataContext(Program.conStr);
            //        condb.Connection.Open();
            //        condb.Connection.Close();
            //    }
            //    catch (Exception)
            //    {
            //        MssBox.iWaitForm(splashScreenManager1);
            //        if (MssBox.Question("เชื่อมต่อฐานข้อมูลไม่สำเร็จ !") == DialogResult.Yes)
            //        {
            //            var x = new SettingForm();
            //            x.ShowDialog();

            //            goto GT;
            //        }
            //        return;
            //    }
            //    MssBox.iWaitForm(splashScreenManager1);
            //}
            //catch (Exception ex)
            //{
            //    MssBox.iWaitForm(splashScreenManager1);
            //    MssBox.Error(ex.Message);
            //}
            #endregion
            if (loadDB())
            {
                var df = Properties.Settings.Default;
                lbSvDetail.Caption = string.Format("Server Host: {0} | Database Name: {1}", df.Host, df.DBName);
            }
            else
            {
                var Setting = new SettingForm();
                Setting.ShowDialog();
            }
        }
예제 #4
0
        private void HandleChangeSavePath(object sender, RoutedEventArgs e) // 저장 경로 변경을 위한 이벤트 핸들러
        {
            var set = Properties.Settings.Default;

            using var dialog        = new CommonOpenFileDialog { IsFolderPicker = true };
            dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/ITS";

            if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
            {
                // 설정 변경 후 필요 폴더 생성
                set.IsSavePathCustomed = true;
                set.SavePath           = dialog.FileName;
                ttsFileSavePath.Text   = set.SavePath;

                DirectoryInfo dmp3 = new DirectoryInfo(dialog.FileName + "/mp3");
                DirectoryInfo dtxt = new DirectoryInfo(dialog.FileName + "/txt");

                dmp3.Create();
                dtxt.Create();
            }

            // 설정 저장
            set.Save();
            SettingForm.Focus();
        }
예제 #5
0
        private void BtnSetting_Click(object sender, EventArgs e)
        {
            SettingForm form = new SettingForm();

            form.StartPosition = FormStartPosition.CenterParent;
            form.ShowDialog();
        }
예제 #6
0
        private void settings_btn_Click(object sender, EventArgs e)
        {
            SettingForm s = new SettingForm(this);

            s.Show();
            this.Hide();
        }
예제 #7
0
        //Open the settings form,disable main form.
        private void settingToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Enabled = false;
            SettingForm settingForm = new SettingForm(this);

            settingForm.Show();
        }
예제 #8
0
 private void BindFormToDbModel(SettingForm form, Setting model, SaveReturn saveReturn)
 {
     // %% there needs to be a line of code like the one below for each field in SettingForm to assign the form fields to the model fields.
     model.Value = VerifyNotBlank(saveReturn, form.Value, "Value", "Setting Value");
     // %% if value is blank, an error message is stored in saveReturn, "Value" is the control ID (usually the field name) on the webpage to focus on
     // "Setting Value" is the text prompt to the user.  User will see "Setting Value cannot be blank"
 }
예제 #9
0
 public void buttonPlaySetting()
 {
     if (settingForm.CanStartGame())
     {
         form_view.CreateBoard(StatusApplication.game);
         if (game_model.GetStatusApplication() == StatusApplication.constructor)
         {
             game_model.FillBoardOnForm();
             form_view.panel2.Visible = false;
         }
         else
         {
             buttonClear();
             //form_view.ChangePanels();
             game_model.FillBoardAndListCheckers();
         }
         game_model.SetGame(settingForm.GetColorPlayer1(), settingForm.GetStatusPl1(), settingForm.GetStatusPl2(), settingForm.GetDepthPl1(), settingForm.GetDepthPl2(),
                            settingForm.GetSearchPl1(), settingForm.GetSearchPl2(), settingForm.GetEvaluatePl1(), settingForm.GetEvaluatePl2(), StatusGame.wait);
         if ((game_model.GetStatusPlayer() == StatusPlayer.human) && (game_model.SearchEatingAndWriteToMove()))
         {
             game_model.SetStatusGame(StatusGame.waitEat);
         }
         settingForm.Close();
         settingForm = null;
         game_model.StartGame();
     }
 }     //stting
예제 #10
0
        void Settings(object sender, System.EventArgs e)
        {
            Action <MineFieldSettings> callback = SetSettings;
            SettingForm settingForm             = new SettingForm(gameSettings, callback);

            settingForm.ShowDialog();
        }
예제 #11
0
        public ActionResult <object> SaveExamTestDate([FromBody] SettingForm form)
        {
            try
            {
                Init();
                List <string> sbError = new List <string>();

                if (!ModelState.IsValid)
                {
                    Response.StatusCode = 400;
                    return("Failed getting student id");
                }
                else
                {
                    var setting = _settingService.GetSchoolSetting(_user.SchoolID, ref sbError);
                    setting.ExamMarkSubmissionClosingDate = form.Exam;
                    setting.TestMarkSubmissionClosingDate = form.Test;

                    var studentSaved = _settingService.Save(setting, ref sbError);
                    if (studentSaved == null)
                    {
                        Response.StatusCode = 400;
                        return("student save failed " + string.Join(" , ", sbError));
                    }
                    else
                    {
                        return((string)"student saved successfully");
                    }
                }
            }
            catch (Exception er)
            {
                return(Error(er));
            }
        }
예제 #12
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //检测应用程序是否已经运行
            //如果已经运行,则只允许一个实例
            Process instance = OnlyOneInstance.RunningInstance();

            if (instance != null)
            {
                OnlyOneInstance.HandleRunningInstance(instance);
                return;
            }

            //配置文件不存在或配置已失效,则创建
            if (!GlobalConfigVars.IsWellSetting())
            {
                SettingForm settingForm = new SettingForm();
                // 取消配置,退出应用程序
                if (settingForm.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            Application.Run(new MainForm());
        }
예제 #13
0
    /// <summary>
    /// 打开设置窗口
    /// </summary>
    private void OnSettingToolStripMenuItem_Click(object sender, EventArgs e)
    {
        SettingForm settingForm = new SettingForm();

        settingForm.StartPosition = FormStartPosition.CenterParent;
        settingForm.ShowDialog();
    }
        public LinkSettingPage(SettingForm settingForm)
        {
            InitializeComponent();
            this.SettingForm = settingForm;



            if (settingForm.LinkSettings.ShorterLink == true)
            {
                YesShortLinkRadio.IsChecked = true;
            }
            else
            {
                NoShortLinkRadio.IsChecked = true;
            }

            if (SettingForm.LinkSettings.ShorterLinkType == "ali.pub")
            {
                AliPubShortLinkRadio.IsChecked = true;
            }
            else
            {
                GotByShortLinkRadio.IsChecked = true;
            }
        }
        private void BtnSettings_Click(object sender, EventArgs e)
        {
            SettingForm SettingForm = new SettingForm();

            Enabled = false;
            SettingForm.FormClosed += ReactivateWindow;
            SettingForm.Show();
        }
예제 #16
0
        private void OnNewToolMenuItemClick(object sender, EventArgs e)
        {
            var dialog = new SettingForm {
                tabs = { SelectedIndex = 1 }
            };

            dialog.ShowDialog(this);
        }
예제 #17
0
 public static SettingRoutes GetInstance(SettingForm viewForm)
 {
     if (settingRoutes == null)
     {
         settingRoutes = new SettingRoutes(viewForm);
     }
     return(settingRoutes);
 }
예제 #18
0
        }//options.txt文件检测

        private void RCT3plusReplace()
        {
            File.Copy(MainForm.Value.Game_Address + "//RCT3plus.exe", "Backups//RCT3plus_Backup.exe", true);
            OptionsCheckInformation.Text += "正在替换RCT3plus.exe......\r\n";
            Assembly a = Assembly.GetExecutingAssembly();

            SettingForm.CopyStream(a.GetManifestResourceStream("RCT3启动器.Resources.RCT3plus.exe"), File.Open(MainForm.Value.Game_Address + "//RCT3plus.exe", FileMode.Create));
            OptionsCheckInformation.Text += "替换成功,请尝试是否能启动游戏。\r\n";
        }//RCT3plus.exe文件替换
예제 #19
0
 public void buttonPlayInConstructor()
 {
     if (settingForm != null)
     {
         settingForm.Close();
     }
     settingForm = new SettingForm(this, TypeSettingForm.constructor);
     settingForm.Show();
 }
예제 #20
0
 public void buttonBotVSBot()
 {
     game_model.SetStatusApplication(StatusApplication.game);
     if (settingForm != null)
     {
         settingForm.Close();
     }
     settingForm = new SettingForm(this, TypeSettingForm.botVSbot);
     settingForm.Show();
 }
        public ViewSettingPage(SettingForm settingForm)
        {
            InitializeComponent();
            this.SettingForm = settingForm;

            WallpaperLabel.Content = SettingForm.Settings.MediaElement;
            BackgroundSlider.Value = SettingForm.Settings.BackgroundDark * 100;

            BackgroundLabel.Content = Math.Round(SettingForm.Settings.BackgroundDark * 100);
        }
예제 #22
0
        /// <summary>メニュー クリックイベント</summary>
        /// <param name="sender">発生元オブジェクト</param>
        /// <param name="e">イベントデータ</param>
        private void OptionMenuItem_Click(object sender, EventArgs e)
        {
            SettingForm  setting = new SettingForm(this.shelf);
            DialogResult result  = setting.ShowDialog();

            if (result == DialogResult.OK)
            {
                this.DetailList.RefreshColumns(this.shelf.Columns);
                this.finds.Refresh();
            }
        }
예제 #23
0
    //Resouce Setting
    private void resouceSettingClick(object sender, EventArgs e)
    {
        SettingForm settingForm = new SettingForm();

        settingForm.SelectSetting = "Resource Machines";
        DialogResult result = settingForm.ShowDialog();

        if (result == DialogResult.OK)
        {
            this.loadSSHConfig();
        }
    }
예제 #24
0
 private void simpleButton1_Click(object sender, EventArgs e)
 {
     try
     {
         SettingForm sf = new SettingForm();
         sf.ShowDialog();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #25
0
 /// <summary>
 /// 共通設定を起動する
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void SettingButton_Click(object sender, EventArgs e)
 {
     try
     {
         SettingForm form = new SettingForm();
         form.ShowDialog(this);
     }
     catch (Exception ex)
     {
         throw Program.ThrowException(ex);
     }
 }
예제 #26
0
        public void Setting()
        {
            if (!Current.CheckNetworkStatus())
            {
                return;
            }

            m_setting = new SettingForm(m_autoUpdator);
            m_setting.ShowDialog();

            m_setting = null;
        }
예제 #27
0
        }//DEP设置

        private void Install4GB_Click(object sender, EventArgs e)
        {
            Assembly a = Assembly.GetExecutingAssembly();

            SettingForm.CopyStream(a.GetManifestResourceStream("RCT3启动器.Resources.4gb_patch.exe"), File.Open("4GB_Patch.exe", FileMode.Create));
            Process process = new Process();

            process.StartInfo.FileName = "4GB_Patch.exe";
            this.Activate();
            process.Start();
            MessageBox.Show("请允许程序获取管理员权限,选中游戏目录中的RCT3plus.exe,再点击打开。最后点击OK结束程序。", "请根据步骤操作", MessageBoxButtons.OK, MessageBoxIcon.Information);
            MessageBox.Show("如果发现没有作用,请将游戏目录内的RCT3.exe和RCT3plus.exe的属性中的兼容性设置为XP SP3,而且选中以管理员运行程序。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }//4GB Patch补丁安装
예제 #28
0
        private void SettingButton_Click(object sender, EventArgs e)
        {
            focusPanel.Height = settingButton.Height;
            focusPanel.Top    = settingButton.Top;

            SettingForm.Dock     = System.Windows.Forms.DockStyle.Fill;
            SettingForm.TopLevel = false;
            SettingForm.TopMost  = true;

            this.panel4.Controls.Clear();
            this.panel4.Controls.Add(SettingForm);
            SettingForm.Show();
        }
예제 #29
0
 //配置窗口
 private void btnSettingForm_Click(object sender, EventArgs e)
 {
     if (settingForm.IsNullOrDisposed())
     {
         settingForm = new SettingForm(shortCommand.ShortNameAndCommands);
         settingForm.UpdateSettingsAction += UpdateSettings;
         settingForm.Show();
     }
     else
     {
         settingForm.Activate();
     }
 }
예제 #30
0
        static void Main()
        {
            Icon mainIcon    = new Icon("../../Resources/Images/caro.ico");
            Icon settingIcon = new Icon("../../Resources/Images/setting.ico");
            Icon aboutIcon   = new Icon("../../Resources/Images/about.ico");

            CaroService = new Service();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Initliaze form
            mainForm    = new MainForm(Constants.OVERVIEW, mainIcon);
            settingForm = new SettingForm(Constants.MAIN_SETTING, settingIcon);
            aboutForm   = new AboutForm(Constants.ABOUT, aboutIcon);

            CaroService.GetForms(mainForm, settingForm, aboutForm);

            // Initliaze routers
            routes = Routes.GetInstance(mainForm);
            routes.RoutingEvent += (sender, e) =>
            {
                Control control = sender as Control;
                if (control != null)
                {
                    mainForm.Text = CaroService.Language.GetString(e.title);
                }
            };
            routes.MainViewEvent += (sender, e) =>
            {
                CaroService.Board.CreateNewGame(CaroService.Player.Turn);
            };
            routes.Routing(Constants.OVERVIEW);
            CaroService.Board.InitMainView(routes.MainView);
            CaroService.Player.InitMainView(routes.MainView);
            CaroService.Timer.InitMainView(routes.MainView);

            // Initiliaze setting routes
            settingRoutes = SettingRoutes.GetInstance(settingForm);
            settingRoutes.RoutingEvent += (sender, e) =>
            {
                Control control = sender as Control;
                if (control != null)
                {
                    settingForm.Text = CaroService.Language.GetString(e.title);
                }
            };
            settingRoutes.Routing(Constants.MAIN_SETTING);

            Application.Run(mainForm);
        }
예제 #31
0
 //Open the settings form,disable main form.
 private void settingToolStripMenuItem_Click(object sender, EventArgs e)
 {
     this.Enabled = false;
     SettingForm settingForm = new SettingForm(this);
     settingForm.Show();
 }