コード例 #1
0
ファイル: Prim.xaml.cs プロジェクト: chauzov1995/TreeCad
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            Properties.Settings ps = Properties.Settings.Default;
            ps.Top4  = this.Top;
            ps.Left4 = this.Left;


            if (this.WindowState == WindowState.Maximized)
            {
                ps.SizeToContent4 = 1;
            }
            else
            {
                ps.SizeToContent4 = 0;
                ps.Width4         = this.Width;
                ps.Height4        = this.Height;
            }



            ps.Save();



            //pfrhsnbt

            string t = tb1.Text.Replace('\'', ' ').Replace('"', '#').Replace(';', '|').Replace(',', '@').Replace('/', '№');


            if (zakrit_ok)
            {
                //    MessageBox.Show(t);
                this.text_otvet = t;
            }
            else
            {
                if (this.text_otvet != t)
                {
                    var ms = MessageBox.Show(
                        "Вы изменили примечания, хотели бы Вы их сохранить?",
                        "Предупреждение",
                        MessageBoxButton.YesNoCancel,
                        MessageBoxImage.Warning);

                    if (ms == MessageBoxResult.Yes)
                    {
                        //    MessageBox.Show(t);
                        this.text_otvet = t;
                    }
                    if (ms == MessageBoxResult.Cancel)
                    {
                        //    MessageBox.Show(t);
                        e.Cancel = true;
                    }
                }
            }
        }
コード例 #2
0
ファイル: Prim2.xaml.cs プロジェクト: chauzov1995/TreeCad
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            Properties.Settings ps = Properties.Settings.Default;
            ps.Top4  = this.Top;
            ps.Left4 = this.Left;


            if (this.WindowState == WindowState.Maximized)
            {
                ps.SizeToContent4 = 1;
            }
            else
            {
                ps.SizeToContent4 = 0;
                ps.Width4         = this.Width;
                ps.Height4        = this.Height;
            }



            ps.Save();


            string autoptim_otvet = "";

            foreach (btn_spis elem in lbbutton.Items)
            {
                autoptim_otvet += (elem as btn_spis).name + "^";
            }
            autoptim_otvet = autoptim_otvet.Trim('^');
            //  EDIT = "1";

            string t = @"PRIM=" + tb1.Text.Replace('\'', ' ').Replace('"', '#').Replace(';', '|').Replace(',', '@').Replace('/', '№').Replace(':', ' ').Trim() + @";AVTO=" + autoptim_otvet + @";EDIT=" + EDIT;

            // MessageBox.Show(t);
            //pfrhsnbt
            if (zakrit_ok)
            {
                this.text_otvet = t;
            }
            else
            {
                if (this.text_otvet != t)
                {
                    if (MessageBox.Show(
                            "Вы изменили примечания, хотели бы Вы их сохранить?",
                            "Предупреждение",
                            MessageBoxButton.YesNo,
                            MessageBoxImage.Question) == MessageBoxResult.Yes)
                    {
                        this.text_otvet = t;
                    }
                }
            }
        }