예제 #1
0
        private void openLast_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            string prevFileName = loadConfiguration();

            if (File.Exists(prevFileName))
            {
                string FileName = prevFileName;
                if (MdiChildren.Length == 0)
                {
                    Open(FileName);
                }
                else
                {
                    if (MdiChildren.Any(p => p.Text == FileName))
                    {
                        MdiChildren.First(p => p.Text == FileName).Activate();
                    }
                    else
                    {
                        Open(FileName);
                    }
                }
            }
            else
            {
                MessageBox.Show("Файл с последним проектом не найден!");
            }
        }
예제 #2
0
        private void openAccWindow()
        {
            accForm acf = new accForm();

            acf.Owner     = (Form)this;
            acf.MdiParent = this;
            acf.Show();

            if (MdiChildren.Length <= 0)
            {
                return;
            }

            Task taskA = new Task(() =>
            {
                while (true)
                {
                    try
                    {
                        if (!MdiChildren.Any())
                        {
                            startProgram();
                            break;
                        }
                    }
                    catch
                    {
                        //Debug.WriteLine("openAccWindow() crashed");
                        break;
                    }
                }
            });

            taskA.Start();
        }
예제 #3
0
        private void ShowNewForm(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog   = new SaveFileDialog();
            string         PrevFullFileName = loadConfiguration();
            string         prevPath;

            if (File.Exists(PrevFullFileName))
            {
                prevPath = Path.GetFullPath(PrevFullFileName);
                saveFileDialog.InitialDirectory = prevPath;
            }
            else
            {
                saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            }
            saveFileDialog.FileName = "geom_model";
            saveFileDialog.Filter   = "Preprocessor Files (*.prp)|*.prp|All Files (*.*)|*.*";
            if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                ProjectForm childForm = new ProjectForm();
                childForm.MdiParent   = this;
                childForm.FormClosed += new FormClosedEventHandler(ChildClosed);
                childForm.WindowState = FormWindowState.Maximized;

                string FileName = saveFileDialog.FileName;
                if (MdiChildren.Any(p => p.Text == FileName))
                {
                    MdiChildren.First(p => p.Text == FileName).Close();
                }

                Save(FileName);
            }
        }
예제 #4
0
        private void barButtonItem2_ItemClick(object sender, ItemClickEventArgs e)
        {
            MdiChildren.Any();
            var currentItems = new List <string>();

            foreach (var item in MdiChildren)
            {
                currentItems.Add(item.Text);
            }

            var genCounter = loginObj.Counters.Where(x => !currentItems.Contains(x.CounterName)).ToList();

            if (genCounter.Count > 0)
            {
                for (int i = 0; i < genCounter.Count; i++)
                {
                    var f = new FrmMain3(genCounter[i]);
                    f.Text      = genCounter[i].CounterName;
                    f.MdiParent = this;
                    f.Show();
                }
            }
            genUserTabFinish = true;

            //check call active
            if (MdiChildren.Any())
            {
                if (this.ActiveMdiChild is IChildMethods)
                {
                    ((IChildMethods)this.ActiveMdiChild).enableTimer();
                }
            }
        }
예제 #5
0
 private void frmMain_Activated(object sender, EventArgs e)
 {
     if (!MdiChildren.Any())
     {
         cmdSave.Enabled = false;
     }
 }
예제 #6
0
        private void FrmMain2_MdiChildActivate(object sender, EventArgs e)
        {
            try
            {
                if (genUserTabFinish)
                {
                    if (MdiChildren.Any())
                    {
                        if (this.ActiveMdiChild is IChildMethods)
                        {
                            ((IChildMethods)this.ActiveMdiChild).enableTimer();
                        }

                        var control = ((System.Windows.Forms.ContainerControl)sender).ActiveControl;
                        foreach (Form f in this.MdiChildren)
                        {
                            if (f.GetType() == typeof(FrmMain3))
                            {
                                if (f.Text != control.Text)
                                {
                                    ((IChildMethods)f).disableTimer();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
        }
        void OnNextClick(object sender, EventArgs e)
        {
            if (!TryParseCostingData)
            {
                return;
            }

            if (_winSettingProvider.StockUploadManulMode)
            {
                bool isAlreadyOpen = MdiChildren.Any(x => x.Name == typeof(frmCostingRates).Name);
                if (isAlreadyOpen)
                {
                    MdiChildren.Single(x => x.Name == typeof(frmCostingRates).Name).Activate();
                    return;
                }
                frmCostingRates.ItemCategory = MetalType;
                ShowManagedModalForm <frmCostingRates>(this, CostingRate);
            }
            else
            {
                bool isAlreadyOpen = MdiChildren.Any(x => x.Name == typeof(frmExcelCostingRates).Name);
                if (isAlreadyOpen)
                {
                    MdiChildren.Single(x => x.Name == typeof(frmExcelCostingRates).Name).Activate();
                    return;
                }
                frmExcelCostingRates.MetalType = MetalType;
                ShowManagedModalForm <frmExcelCostingRates>(this, CostingRate);
            }
        }
예제 #8
0
        private void SaveAs()
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            string PrevFileName = loadConfiguration();
            string prevPath;

            if (File.Exists(PrevFileName))
            {
                prevPath = Path.GetFullPath(PrevFileName);
                saveFileDialog.InitialDirectory = prevPath;
            }
            else
            {
                saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            }

            saveFileDialog.Filter = "Preprocessor Files (*.prp)|*.prp|All Files (*.*)|*.*";
            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                string FileName = saveFileDialog.FileName;
                if (MdiChildren.Any(p => p.Text == FileName))
                {
                    MdiChildren.First(p => p.Text == FileName).Close();
                }
                SaveAs(FileName);
            }
        }
예제 #9
0
        public PacijentIzbornik()
        {
            InitializeComponent();
            klijent           = Controls.OfType <MdiClient>().First();
            klijent.GotFocus += (s, e) => {
                if (!MdiChildren.Any(x => x.Visible))
                {
                    klijent.SendToBack();
                }
            };
            bool   spol       = false;
            string imePrezime = String.Empty;

            foreach (var VARIABLE in globalnaKlasa.klinika17270.ListaPacijenata)
            {
                if (VARIABLE._JMBG == globalnaKlasa.jmbgZaPacijenta)
                {
                    if (VARIABLE._Spol == "Žensko")
                    {
                        spol = true;
                    }
                    imePrezime = VARIABLE._Ime + " " + VARIABLE._Prezime;
                }
            }
            if (spol)
            {
                label3.Text = "Dobro došla, " + imePrezime;
            }
            else
            {
                label3.Text = "Dobrodošao, " + imePrezime;
            }
        }
예제 #10
0
 private void allesSchliessenToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (MdiChildren.Any())
     {
         foreach (var c in MdiChildren)
         {
             c.Close();
         }
     }
 }
예제 #11
0
 public frmPrincipal()
 {
     InitializeComponent();
     client           = Controls.OfType <MdiClient>().First();
     client.GotFocus += (s, e) => {
         if (!MdiChildren.Any(x => x.Visible))
         {
             client.SendToBack();
         }
     };
 }
예제 #12
0
        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (MdiChildren.Any(form => (form is IUIPlugIn) && (CheckDirty((IUIPlugIn)form) == DialogResult.Cancel)))
            {
                e.Cancel = true;
                return;
            }

            _preferences.SaveSettings();
            _historyItemClick = null;
        }
예제 #13
0
 private void OnEditorClosed() {
   // Creating and then manually showing and hiding the separator above the MDI child
   // list in the Windows menu (= MenuStrip.MdiWindowListItem) prevents the separator
   // from remaining visible when all children have been closed, which is what happens
   // when we allow the separator to be created and shown automatically.  See
   // https://stackoverflow.com/questions/12951820/extra-separator-after-mdiwindowlistitem-when-no-child-windows-are-open
   if (!MdiChildren.Any()) {
     WindowsSeparator3.Visible = false;
     DisableGridToolStripButtons();
   }
 }
예제 #14
0
 public OstaliForma()
 {
     InitializeComponent();
     klijent           = Controls.OfType <MdiClient>().First();
     klijent.GotFocus += (s, e) => {
         if (!MdiChildren.Any(x => x.Visible))
         {
             klijent.SendToBack();
         }
     };
 }
예제 #15
0
        private void btnLogout_Click(object sender, EventArgs e)
        {
            foreach (var frm in MdiChildren)
            {
                frm.Close();
            }

            if (!MdiChildren.Any())
            {
                Application.Restart();
            }
        }
예제 #16
0
 private void EditMenu_DropDown_Opening(object? sender, CancelEventArgs e) {
   if (MdiChildren.Any()) {
     EditorView?.CurrentGrid?.EnableOrDisableMenuItems(
       EditCutMenuItem, EditCopyMenuItem, EditPasteMenuItem,
       EditDeleteMenuItem,
       EditSelectAllMenuItem, EditSelectRowMenuItem, EditDeleteSelectedRowsMenuItem);
   } else {
     foreach (ToolStripItem item in EditMenu.DropDownItems) {
       item.Enabled = false;
     }
   }
 }
예제 #17
0
 private void FileOpenMenuItem_Click(object? sender, EventArgs e) {
   if (!MdiChildren.Any()) {
     FileNewMenuItem_Click(sender, e);
     return;
   }
   SelectEditorView.Text = "Select Table for Current Editor";
   if (SelectEditorView.ShowDialog(this) == DialogResult.Cancel) {
     return;
   }
   Cursor = Cursors.WaitCursor;
   BeginInvoke((Action)OpenEditorAsync);
 }
예제 #18
0
        private void closeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bool openchild = false;

            if (!MdiChildren.Any())
            {
                openchild = true;
            }
            else
            {
                this.ActiveMdiChild.Close();
            }
        }
예제 #19
0
 public Form1()
 {
     InitializeComponent();
     //IsMdiContainer = true;
     client           = Controls.OfType <MdiClient>().First();
     client.GotFocus += (s, e) =>
     {
         if (!MdiChildren.Any(x => x.Visible))
         {
             client.SendToBack();
         }
     };
 }
예제 #20
0
 protected override void OnFormClosed(FormClosedEventArgs e) {
   base.OnFormClosed(e);
   Controller.IsToolBarVisible = ToolStrip.Visible;
   Controller.IsStatusBarVisible = StatusLabel.Visible;
   Controller.TableName = (MdiChildren.Any()
     ? EditorView?.MainGrid.Controller.TableName
     : SelectEditorView.Controller.SelectedTableName)!;
   // Explicitly closing all the MIDI child forms fixes a problem where, if multiple
   // child forms were open and maximized and the most recently opened child form was
   // not active, the child form window state was incorrectly saved as Normal.
   WindowsCloseAllMenuItem_Click(this, EventArgs.Empty);
   SizeableFormOptions.Save();
 }
예제 #21
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Color clr = new Color();

            PropertyInfo[] colors = clr.GetType().GetProperties();
            for (int i = 8; i <= 72; i++)
            {
                tscbFontSize.Items.Add(i);
            }

            InstalledFontCollection fontsCollection = new InstalledFontCollection();

            FontFamily[] fontFamilies = fontsCollection.Families;
            foreach (FontFamily font in fontFamilies)
            {
                tscbFontFamily.Items.Add(font.Name);
            }

            this.tscbBackColor.ComboBox.DrawMode = DrawMode.OwnerDrawFixed;
            this.tscbFontColor.ComboBox.DrawMode = DrawMode.OwnerDrawFixed;

            foreach (PropertyInfo color in colors)
            {
                if (color.PropertyType == typeof(System.Drawing.Color))
                {
                    tscbBackColor.Items.Add(color.Name);
                    tscbFontColor.Items.Add(color.Name);
                }
            }

            //inisiasi
            tscbFontSize.SelectedIndex = 3;
            tscbFontFamily.Text        = "Calibri";
            tscbFontColor.Text         = "Black";
            tscbBackColor.Text         = "White";
            changeText();
            //event
            this.tscbBackColor.ComboBox.DrawItem += new DrawItemEventHandler(tscbFontColor_DrawItem);
            this.tscbFontColor.ComboBox.DrawItem += new DrawItemEventHandler(tscbFontColor_DrawItem);

            MdiClient client = Controls.OfType <MdiClient>().First();

            client.GotFocus += (s, ev) =>
            {
                if (!MdiChildren.Any(x => x.Visible))
                {
                    client.SendToBack();
                    rtbNote.BringToFront();
                }
            };
        }
예제 #22
0
 public Form1()
 {
     InitializeComponent();
     IsMdiContainer = true;
     //Find the MdiClient and hold it by a variable
     client = Controls.OfType <MdiClient>().First();
     //This will check whenever client gets focused and there aren't any
     //child forms opened, Send the client to back so that the other controls can be shown back.
     client.GotFocus += (s, e) => {
         if (!MdiChildren.Any(x => x.Visible))
         {
             client.SendToBack();
         }
     };
 }
예제 #23
0
 private void WindowsMenu_DropDown_Opening(object? sender, CancelEventArgs e) {
   bool hasChildren = MdiChildren.Any();
   foreach (ToolStripItem item in WindowsMenu.DropDownItems) {
     item.Enabled = hasChildren;
   }
   if (!hasChildren) {
     return;
   }
   bool hasMinimizedChildren = (
     from child in MdiChildren
     where child.WindowState == FormWindowState.Minimized
     select child).Any();
   WindowsArrangeIconsMenuItem.Enabled = hasMinimizedChildren;
   WindowsNextMenuItem.Enabled =
     WindowsPreviousMenuItem.Enabled = MdiChildren.Length > 1;
 }
예제 #24
0
        private void EDGForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!MdiChildren.Any())
            {
                return;
            }

            switch (MessageBox.Show("Nie zamknięto wszystkich okien programu, czy aby napewno chcesz kontynuowac?", "Zamykanie Programu.", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1))
            {
            case DialogResult.Yes:
                break;

            case DialogResult.No:
                e.Cancel = true;
                break;
            }
        }
예제 #25
0
        private void CreateContextTabMenu()
        {
            btnContextMdiTabs.SubItems.Clear();

            if (!MdiChildren.Any())
            {
                return;
            }

            foreach (var child in MdiChildren)
            {
                var buttonItem = new ButtonItem("btn" + child.Name, child.Text)
                {
                    Tag = child
                };

                buttonItem.Click += (s, e) =>
                {
                    var frm = (Form)((ButtonItem)s).Tag;
                    frm?.Activate();
                };

                btnContextMdiTabs.SubItems.Add(buttonItem);
            }

            var btnCloseAll = new ButtonItem
            {
                Text       = @"Close All Tabs",
                BeginGroup = true
            };

            btnCloseAll.Click += (s, e) =>
            {
                foreach (var w in MdiChildren)
                {
                    w.Close();
                }
            };


            btnContextMdiTabs.SubItems.Add(btnCloseAll);
            btnContextMdiTabs.Refresh();

            btnContextMdiTabs.ShowSubItems = true;
            btnContextMdiTabs.RecalcSize();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            getFontColor(tscbFontColor.ComboBox);
            getFontFamily();
            getFontSize();
            tscbFontColor.SelectedIndex = 10;
            tscbFontColor.Text          = "Black";
            tscbFontFamily.SelectedItem = "Calibri";
            tscbFontSize.SelectedItem   = 12;
            ubahFont();
            MdiClient client = Controls.OfType <MdiClient>().First();

            client.GotFocus += (s, ev) =>
            {
                if (!MdiChildren.Any(x => x.Visible))
                {
                    client.SendToBack();
                    rtbText.BringToFront();
                }
            };
        }
예제 #27
0
        public DoktorForma()
        {
            InitializeComponent();
            klijent = Controls.OfType <MdiClient>().First();

            klijent.GotFocus += (s, e) => {
                if (!MdiChildren.Any(x => x.Visible))
                {
                    klijent.SendToBack();
                }
            };
            comboBox1.Text = "--Odaberite--";
            comboBox1.Items.Add("Ortopedska");
            comboBox1.Items.Add("Kardiološka");
            comboBox1.Items.Add("Dermatološka");
            comboBox1.Items.Add("Internistička");
            comboBox1.Items.Add("Otorinolaringološka");
            comboBox1.Items.Add("Oftamološka");
            comboBox1.Items.Add("Laboratorija");
            comboBox1.Items.Add("Stomatološka");

            comboBox2.Text = "--Odaberite--";
            comboBox2.Items.Add("Ortopedski");
            comboBox2.Items.Add("Kardioloski");
            comboBox2.Items.Add("Dermatoloski");
            comboBox2.Items.Add("Internisticki");
            comboBox2.Items.Add("Otorinolaringoloski");
            comboBox2.Items.Add("Oftamoloski");
            comboBox2.Items.Add("Laboratorijski");
            comboBox2.Items.Add("Stomatoloski");

            foreach (var VARIABLE in globalnaKlasa.registrovaniPacijenti)
            {
                string temp = VARIABLE.Key;
                temp += " " + VARIABLE.Value.Item1;
                temp += " " + VARIABLE.Value.Item2;
                comboBox3.Items.Add(temp);
                comboBox4.Items.Add(temp);
            }
        }
예제 #28
0
        /*
         *      Обработка MouseUp по кнопку, ассоциируемой с таблицей (TableButton)
         */
        public void TableBtn_X_MouseUp(object sender, MouseEventArgs e)
        {
            var       button    = (Button)sender;
            TableForm tableForm = new TableForm();

            tableForm.Init(
                Model.TableDatas.Where(i => i.Descriptor.Name == button.Text).ElementAt(0),
                TableForm_FormClosed,
                TableForm_ModelChanged);

            switch (e.Button)
            {
            case MouseButtons.Left:
            {
                // если окно таблицы, с которой связяна эта кнопка, НЕ открыто
                if (!MdiChildren.Any(i => i.Text == button.Text))
                {
                    var tableData = TableData.Get(tableForm);
                    Model.AddExistingTable(tableData);
                }
                else
                {
                    Form mdiForm = MdiChildren.Where(i => i.Text == button.Text).ElementAt(0);
                    mdiForm.BringToFront();
                }

                break;
            }

            case MouseButtons.Right:
            {
                CtxMenuTableButtonName = button.Text;

                CtxMS_TableBtnX.Show(Cursor.Position);

                break;
            }
            }
        }
예제 #29
0
        private void QuickSaveProjectToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                this.projectBindingSource.EndEdit();

                if (projectFile == null)
                {
                    saveProjectToolStripMenuItem_Click(sender, e);
                    return;
                }
                this.service.Save(projectFile);

                this.projectBindingSource.ResetBindings(false);
                this.service.FirePropertyChanged("CurrentProject");

                if (MdiChildren.Any(x => x.GetType() == typeof(mdiInterview)))
                {
                    foreach (mdiInterview frm in MdiChildren.Where(x => x.GetType() == typeof(mdiInterview)))
                    {
                        if (frm.cboScoring != null)
                        {
                            for (int i = 0; i <= frm.cboScoring.GetUpperBound(0); i++)
                            {
                                for (int j = 0; j <= frm.cboScoring.GetUpperBound(1); j++)
                                {
                                    frm.cboScoring[i, j].BackColor = Color.White;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error while saving a project");
            }
        }
예제 #30
0
        /// <summary>
        /// если сообщение пришло в чат, а чат открыт в какой-то вкладке, неактивной -
        /// - моргнуть этой вкладкой
        /// </summary>
        private void ChatEngineOnMessageReceived(Message message)
        {
            var wndSets = nonChartWindows.FirstOrDefault(w => w.Window == NonChartWindowSettings.WindowCode.Chat);

            if (wndSets == null)
            {
                return;
            }

            var isChildVisible = MdiChildren.Any(c => c is ChatForm && c.Visible);

            if (!isChildVisible) // заморгать вкладкой
            {
                try
                {
                    Invoke(new Action <long>(l => bookmarkStrip.BlinkBookmark(l)), wndSets.ChartTab);
                }
                catch (Exception ex)
                {
                    Logger.Error("ChatEngineOnMessageReceived()", ex);
                }
            }
        }