private void TestTools_Load(object sender, EventArgs e) { border.Resizeable = false; try { Stream str = File.Open(AppResource.AppPaths.GetProfileFilePath("save000.sav"), FileMode.Open); SetupProfile profile = (SetupProfile) new BinaryFormatter().Deserialize(str); str.Close(); pictureBox1.BackColor = profile.AppBorderColor; pictureBox2.BackColor = profile.AppBorderColor; pictureBox3.BackColor = profile.AppTitleColor; pictureBox4.BackColor = profile.AppTitleColor; rdb_delete.Checked = true; rdb_normnal.Checked = profile.ISNormnalmode; cbx_ConseMove.Checked = profile.ConseMove; cbx_EnemyMove.Checked = profile.EnemyMove; cbx_NoMoveCheck.Checked = profile.FreeMove; numericUpDown1.Value = profile.Inteligent; this.border.BorderColor = profile.AppBorderColor; this.border.TitleColor = profile.AppTitleColor; }catch (IOException ex) { MessageBox.Show(ex.Message); Application.Exit(); } }
private void Phong_Load(object sender, EventArgs e) { border.Resizeable = false; pictureBox1.Image = Image.FromFile(AppResource.AppPaths.GetChessmanPNGPath("Xe_Xanh.png")); pictureBox2.Image = Image.FromFile(AppResource.AppPaths.GetChessmanPNGPath("Ngua_Xanh.png")); pictureBox3.Image = Image.FromFile(AppResource.AppPaths.GetChessmanPNGPath("Tuong_Xanh.png")); pictureBox4.Image = Image.FromFile(AppResource.AppPaths.GetChessmanPNGPath("Hau_Xanh.png")); Profile = _profile; }
private void ptb_Setup_Click(object sender, EventArgs e) { TestTools tool = new TestTools(); tool.NewSettingChoosed += delegate(object sd1, SetupProfile e1) { Profile = e1; }; tool.ShowDialog(); }
private void button1_Click(object sender, EventArgs e) { SetupProfile profile = new SetupProfile(pictureBox2.BackColor, pictureBox4.BackColor, rdb_normnal.Checked, cbx_EnemyMove.Checked, cbx_NoMoveCheck.Checked, cbx_ConseMove.Checked, (int)numericUpDown1.Value); try { Stream str = File.Open(AppResource.AppPaths.GetProfileFilePath("save000.sav"), FileMode.Create); new BinaryFormatter().Serialize(str, profile); str.Close(); NewSettingChoosed(this, profile); this.Close(); } catch (IOException ex) { MessageBox.Show(ex.Message); Application.Exit(); } }
private void Chess_Load(object sender, EventArgs e) { Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High; Thread.CurrentThread.Priority = ThreadPriority.Highest; Irefresh += this.Refresh; saveFileDialog1.InitialDirectory = AppResource.AppPaths.SaveFolderPath; openFileDialog1.InitialDirectory = AppResource.AppPaths.SaveFolderPath; Ienable += delegate(Control control, bool enable) { control.Enabled = enable; }; Workthread.IsBackground = true; History.Add(st); BackupH.Add(st.Getcopy()); this.Invoke(Irefresh); try { Stream str = File.Open(AppResource.AppPaths.GetProfileFilePath("save000.sav"), FileMode.Open); Profile = (SetupProfile) new BinaryFormatter().Deserialize(str); str.Close(); } catch (IOException ex) { MessageBox.Show(ex.ToString()); Application.Exit(); } new Customcontrol.Swaper(ptb_Setup, AppResource.AppImage.PNGIcons.setup1, AppResource.AppImage.PNGIcons.setup2); new Customcontrol.Swaper(ptb_reload, AppResource.AppImage.PNGIcons.reload1, AppResource.AppImage.PNGIcons.reload2); new Customcontrol.Swaper(ptb_next, AppResource.AppImage.PNGIcons.next1, AppResource.AppImage.PNGIcons.next2); new Customcontrol.Swaper(ptb_prev, AppResource.AppImage.PNGIcons.prev1, AppResource.AppImage.PNGIcons.prev2); new Customcontrol.Swaper(ptb_bottom, AppResource.AppImage.PNGIcons.bottom1, AppResource.AppImage.PNGIcons.bottom2); new Customcontrol.Swaper(ptb_top, AppResource.AppImage.PNGIcons.Top1, AppResource.AppImage.PNGIcons.Top2); new Customcontrol.Swaper(ptb_abort, AppResource.AppImage.PNGIcons.abort1, AppResource.AppImage.PNGIcons.abort2); new Customcontrol.Swaper(ptb_save, AppResource.AppImage.PNGIcons.save1, AppResource.AppImage.PNGIcons.save2); new Customcontrol.Swaper(ptb_open, AppResource.AppImage.PNGIcons.open1, AppResource.AppImage.PNGIcons.open2); }
public Phong(SetupProfile profile) { InitializeComponent(); _profile = profile; }