Exemplo n.º 1
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (Model.getInstance().uiChanged)
            {
                String       caption = Model.GetTranslationFromID(60);
                String       msg     = Model.GetTranslationFromID(62);
                DialogResult dr      = MessageBox.Show(msg, caption, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);

                if (dr == System.Windows.Forms.DialogResult.Yes)
                {
                    odm.SerializeObjectDefinition();
                    e.Cancel = false;
                }
                else if (dr == System.Windows.Forms.DialogResult.No)
                {
                    e.Cancel = false;
                }
                else if (dr == System.Windows.Forms.DialogResult.Cancel)
                {
                    e.Cancel = true;
                }
            }

            foreach (ICustomControl c in Model.getInstance().allControls)
            {
                if (c.cd.Changed && c.cd.MainDestination != "")
                {
                    Debug.WriteLine("Changed: " + c.cd.Name);
                    String       caption = Model.GetTranslationFromID(60);
                    String       msg     = Model.GetTranslationFromID(61);
                    DialogResult dr      = MessageBox.Show(msg, caption, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);

                    if (dr == System.Windows.Forms.DialogResult.Yes)
                    {
                        WriteConfigurationManager.SaveChanges();
                        e.Cancel = false;
                    }
                    else if (dr == System.Windows.Forms.DialogResult.No)
                    {
                        e.Cancel = false;
                    }
                    else if (dr == System.Windows.Forms.DialogResult.Cancel)
                    {
                        e.Cancel = true;
                    }

                    break;
                }
            }

            SaveBoundaries();
        }
Exemplo n.º 2
0
        private void MainForm_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Alt && e.Control && e.KeyCode == Keys.P)
            {
                SwitchProgMode();
                this.Refresh();
            }

            if (e.Alt && e.Control && e.KeyCode == Keys.G && !model.saving)
            {
                WriteConfigurationManager.SaveChanges();
                ShowNotificationPanel(Model.GetTranslationFromID(74));
            }
            if (model.progMode)
            {
                if (e.Alt && e.Control && e.KeyCode == Keys.S && !model.saving)
                {
                    odm.SerializeObjectDefinition();
                    ShowNotificationPanel(Model.GetTranslationFromID(72));
                }
                if (e.Alt && e.Control && e.KeyCode == Keys.D)
                {
                    System.Diagnostics.Debug.WriteLine("\n###################################");
                    System.Diagnostics.Debug.WriteLine("! Printing Sections:");

                    foreach (Section s in model.sections)
                    {
                        System.Diagnostics.Debug.WriteLine(
                            s.Name + " " + s.Tab.GetType().Name + ":" + s.Tab.Name + " " + s.Button.GetType().Name + ":" + s.Button.Text);
                    }

                    System.Diagnostics.Debug.WriteLine("-----------------------------------");
                    System.Diagnostics.Debug.WriteLine("! Printing List of Controls: ");
                    System.Diagnostics.Debug.WriteLine("\tControl        Parent");
                    System.Diagnostics.Debug.WriteLine("___________________________________");
                    foreach (ICustomControl c in model.allControls)
                    {
                        String line = "\t";
                        if (c.cd.Name != null)
                        {
                            line += c.cd.Name + " ..... ";
                        }
                        if (c.cd.Parent != null)
                        {
                            line += c.cd.Parent.Name;
                        }
                        System.Diagnostics.Debug.WriteLine(line);
                    }
                    System.Diagnostics.Debug.WriteLine("#####################################");
                }

                if (e.Alt && e.Control && e.KeyCode == Keys.R)
                {
                    System.Diagnostics.Debug.WriteLine("\n###################################");
                    Debug.WriteLine("Main Visibility Rights: " + model.mainDisplayRights.ToString());
                    Debug.WriteLine("Main Modificiation Rights: " + model.mainModificationRights.ToString());
                    Debug.WriteLine("---------------------------------------------------------");
                    foreach (ICustomControl c in model.allControls)
                    {
                        string line = "\t";
                        line += "- " + c.cd.Name + "\t\t Display: " + c.cd.operatorVisibility + "\t Modify: " + c.cd.operatorModification;
                        System.Diagnostics.Debug.WriteLine(line);
                    }
                }

                if (e.Alt && e.KeyCode == Keys.Down)
                {
                    ch.MultiplyControl();
                }

                if (e.Control && (e.KeyCode == Keys.Down || e.KeyCode == Keys.Up))
                {
                    ch.TransportControl(e);
                }

                if (e.Control && e.KeyCode == Keys.E)
                {
                    editToolStripMenuItem.PerformClick();
                }
            }
        }