Exemple #1
0
 public static void InvokeAppendText(this ToolStripMenuItem tsmi, string text)
 {
     if (tsmi.GetCurrentParent().InvokeRequired)
     {
         tsmi.GetCurrentParent().Invoke(new MethodInvoker(delegate { tsmi.Text += text; }));
         return;
     }
     tsmi.Text += text;
 }
Exemple #2
0
        private void Compress(object sender, EventArgs e)
        {
            ToolStripMenuItem curMenu   = sender as ToolStripMenuItem;
            ToolStrip         toolStrip = curMenu.GetCurrentParent();

            var itemCheck = (curMenu.GetCurrentParent() as ToolStripDropDown).OwnerItem;

            SetToolStripFunctions(itemCheck.Text, true);
        }
Exemple #3
0
 public static void InvokeEnable(this ToolStripMenuItem tsmi, bool value)
 {
     if (tsmi.GetCurrentParent().InvokeRequired)
     {
         tsmi.GetCurrentParent().Invoke(new MethodInvoker(delegate { tsmi.Enabled = value; }));
         return;
     }
     tsmi.Enabled = value;
 }
 /// <summary>
 /// Helper function along the lines of:
 /// https://msdn.microsoft.com/en-us/library/ms171728.aspx
 /// As there is a timer (aka thread) that can alter UseCombinedVoicepack, this makes it threadsafe
 /// </summary>
 private void SetUseCombinedVoicepackMenuItemChecked(bool check)
 {
     if (_useCombinedVoicepackMenuItem.GetCurrentParent().InvokeRequired)
     {
         var f = new SetUseCombinedVoicepackMenuItemCheckedCallback(SetUseCombinedVoicepackMenuItemChecked);
         _useCombinedVoicepackMenuItem.GetCurrentParent().Invoke(f, new object[] { check });
     }
     else
     {
         _useCombinedVoicepackMenuItem.Checked = check;
     }
 }
Exemple #5
0
        void selectTrackMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem selectTrackMenuItem = sender as ToolStripMenuItem;

            for (int i = 1; i < selectTrackMenuItem.GetCurrentParent().Items.Count; i++)
            {
                ((ToolStripMenuItem)selectTrackMenuItem.GetCurrentParent().Items[i]).Checked = false;
            }

            selectTrackMenuItem.Checked = true;

            ViewModel.Subtitles.Track = (int)selectTrackMenuItem.Tag;
        }
        public static void SeatingScript_Click(object sender, EventArgs e)
        {
            if (sender is ToolStripMenuItem)
            {
                SeatingScript ss = new SeatingScript();

                ToolStripMenuItem          tsi   = (ToolStripMenuItem)sender;
                ScanButtonContextMenuStrip pbcms = (ScanButtonContextMenuStrip)tsi.GetCurrentParent();
                ScanButton scanButton            = pbcms.parentButton;

                if (tsi.Text.Equals(GlobalSettings.SeatingScript.StartSeatingScriptLabel))
                {
                    ss.startSeating(scanButton);
                    tsi.Text = GlobalSettings.SeatingScript.StopSeatingScriptLabel;
                }
                else if (tsi.Text.Equals(GlobalSettings.SeatingScript.StopSeatingScriptLabel))
                {
                    ss.stopSeating(scanButton);
                    tsi.Text        = GlobalSettings.SeatingScript.StartSeatingScriptLabel;
                    scanButton.Text = GlobalSettings.ButtonSettings.ScanButtonLabel;
                }
                else
                {
                    throw new Exception("Labeling of SeatingScript Buttons is wrong!");
                }
            }
            else
            {
                throw new Exception("Sender is no ToolStripMenuItem!");
            }
        }
Exemple #7
0
        private OntologyClass menuItemToClass(ToolStripMenuItem item)
        {
            TreeNode      selectedNode  = ((item.GetCurrentParent() as ContextMenuStrip).SourceControl as TreeView).SelectedNode;
            OntologyClass ontologyClass = selectedNode.Tag as OntologyClass;

            return(ontologyClass);
        }
Exemple #8
0
 //-----------------------------------------------------------------------------------
 void menuAjouterInterventionItem_DropDownOpening(object sender, EventArgs e)
 {
     if (sender is ToolStripMenuItem)
     {
         ToolStripMenuItem item = ((ToolStripMenuItem)sender);
         object            site = item.Tag;
         if (site is CSite)
         {
             // initialise sous menu
             CListeObjetsDonnees listeRel = m_phaseEdite.TypePhase.RelationTypesIntervention;
             if (listeRel.Count == 0)
             {
                 item.GetCurrentParent().Hide();
                 CFormAlerte.Afficher(I.T("There is non possible Intervention defined on this Phase Type|534"), EFormAlerteType.Exclamation);
                 return;
             }
             item.DropDownItems.Clear();
             foreach (CRelationTypePhaseTicket_TypeIntervention rel in listeRel)
             {
                 ToolStripMenuItem sousItem = new ToolStripMenuItem(rel.TypeIntervention.Libelle);
                 sousItem.Tag    = new object[] { site, rel.TypeIntervention };
                 sousItem.Click += new EventHandler(sousItem_Click);
                 item.DropDownItems.Add(sousItem);
             }
         }
     }
 }
        /// <summary>
        /// Start TableModule ==> Scan Button Was clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public static void ControlButton_Click(object sender, EventArgs e)
        {
            ScanButton sb = new ScanButton();

            // Get ScanButton instance depending on where the request came from
            if (sender is ToolStripMenuItem) // From Context Menu
            {
                ToolStripMenuItem          tsi   = (ToolStripMenuItem)sender;
                ScanButtonContextMenuStrip pbcms = (ScanButtonContextMenuStrip)tsi.GetCurrentParent();
                sb = pbcms.parentButton;
            }
            else if (sender is ScanButton) // From LeftClick on ScanButton
            {
                sb = (ScanButton)sender;
            }
            else
            {
                throw new Exception("ControlButton_Click: Unknown Sender");
            }

            // Check Again for Size of the table
            checkEmulatorSize(sb.TableHandle);

            // Scan the table
            TableHandler.scan(sb);
        }
Exemple #10
0
        private void ToolStripMenuItem_testMode_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem modeItem = (ToolStripMenuItem)sender;
            var modeItemParent         = modeItem.GetCurrentParent();

            foreach (var VARIABLE in modeItemParent.Items)
            {
                if (VARIABLE is ToolStripMenuItem tempItem)
                {
                    tempItem.Checked = false;
                    tempItem.Enabled = true;
                }
            }

            modeItem.Checked = true;
            //  modeItem.Enabled = false;
            if (modeItem.Name == "ToolStripMenuItem_Auto")
            {
                _testMode = TestMode.Auto;
                toolStripStatusMode.ForeColor = Color.Black;
            }
            else
            {
                _testMode = TestMode.Manual;
                toolStripStatusMode.ForeColor = Color.Red;
            }

            toolStripStatusMode.Text = "test mode:" + _testMode.ToString();
        }
Exemple #11
0
        //unico handler per occupa e libera tavolo, differenzio il cambio in base allo stato del tavolo cliccato
        private void occupaTavoloToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem  t   = (ToolStripMenuItem)sender;
            ListViewItem       lvi = (ListViewItem)t.GetCurrentParent().Tag;
            LocaleRistorazione r   = LocaleRistorazione.GetInstance();
            Tavolo             tav = (Tavolo)lvi.Tag;

            int index = lvi.ListView.Items.IndexOf(lvi);

            Prenotazione first = getPrenotazione();
            bool         vuota = false;

            if (first == null)
            {
                vuota = true;
            }

            if (!vuota && first.NumeroCoperti <= tav.PostiMax)
            {
                r.Tavoli.ElementAt(index).Stato   = StatoTavolo.Occupato;
                r.Tavoli.ElementAt(index).Numero  = r.Tavoli.IndexOf(r.Tavoli.ElementAt(index)) + 1;
                r.Tavoli.ElementAt(index).Coperti = first.NumeroCoperti;
                r.Tavoli.ElementAt(index).CalcolaTempo.OccupaTavolo();
                r.ListaPrenotazioni.Remove(first);

                MessageBox.Show("Cliente " + first.ToString() + " al " + r.Tavoli.ElementAt(index));
            }
        }
        private void OpenDirToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem mi          = (ToolStripMenuItem)sender;
            ContextMenuStrip  ms          = (ContextMenuStrip)mi.GetCurrentParent();
            ListView          curListView = (ListView)ms.SourceControl;

            if (curListView.SelectedItems.Count == 0)
            {
                return;
            }
            foreach (ListViewItem item in curListView.SelectedItems)
            {
                string strFileName = item.SubItems[2].Text;
                string strPath     = Path.GetDirectoryName(strFileName);
                if (Directory.Exists(strPath))
                {
                    try
                    {
                        System.Diagnostics.Process.Start("explorer", "/select,\"" + strFileName + "\"");
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message + "\n" + strPath, "打开目录失败");
                    }
                }
            }
        }
Exemple #13
0
        private Termin menuItemToTheme(ToolStripMenuItem item)
        {
            TreeNode selectedNode = ((item.GetCurrentParent() as ContextMenuStrip).SourceControl as TreeView).SelectedNode;
            var      theme        = selectedNode.Tag as Termin;

            return(theme);
        }
Exemple #14
0
        private void VideoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem mi = sender as ToolStripMenuItem;

            if (!mi.Checked)
            {
                foreach (object o in mi.GetCurrentParent().Items)
                {
                    ToolStripMenuItem tsi = o as ToolStripMenuItem;
                    if (tsi != null)
                    {
                        tsi.Checked = false;
                    }
                }
                string s = mi.Tag as string;
                Guid   g;
                if (!string.IsNullOrEmpty(s))
                {
                    g = new Guid(s);
                }
                else
                {
                    g = Guid.Empty;
                }

                g_pPlayer.Settings(g);
                mi.Checked = true;
            }
        }
Exemple #15
0
        /// <summary>
        /// 右键录像菜单
        /// </summary>
        private void toolStripMenuItemRecord_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem menu  = sender as ToolStripMenuItem;
            Panel             panel = (menu.GetCurrentParent() as ContextMenuStrip).SourceControl as Panel;

            m_sdkOperator.Dialog.record(panel);
        }
Exemple #16
0
        /// <summary>
        /// Locks Single Button
        /// </summary>
        /// <param name="sender">should be ToolStripMenuItem</param>
        /// <param name="e"></param>
        private void LockButton_Click(object sender, EventArgs e)
        {
            if (sender is ToolStripMenuItem)
            {
                ToolStripMenuItem            tsi   = (ToolStripMenuItem)sender;
                PlayerButtonContextMenuStrip pbcms = (PlayerButtonContextMenuStrip)tsi.GetCurrentParent();

                // Set Caption correctly as it can also get changed by "LockAllButtons", etc
                string displayedText = tsi.Text;
                if (displayedText.Equals("Lock"))
                {
                    PlayerButtonContextMenuActions.lockSeat(pbcms.seatname, pbcms.tablename);
                    tsi.Text = "Unlock";
                }
                else
                {
                    PlayerButtonContextMenuActions.unlockSeat(pbcms.seatname, pbcms.tablename);
                    tsi.Text = "Lock";
                }
            }
            else
            {
                throw new Exception("Sender is no ToolStripMenuItem!");
            }
        }
Exemple #17
0
        private void ctxMnTxViewPatterns_Click(object sender, EventArgs e)
        {
            if (_Model.Store == null)
            {
                MessageBox.Show("Almacén de patrones no seleccionado.");
                return;
            }

            ToolStripMenuItem mnItem = (sender as ToolStripMenuItem);
            ContextMenuStrip  ctx    = (ContextMenuStrip)mnItem.GetCurrentParent();
            TextBox           txb    = (TextBox)ctx.SourceControl;

            string itemName = txb.Name;

            itemName = itemName.Substring(2, itemName.Length - 2);

            var patterns = _Model.Store.GetPdfPatterns("WordGroupsInfos", itemName);

            string fileSufix = $"_{itemName}_wg";

            string fileName = $"{Path.GetDirectoryName(_Model.PdfPath)}{Path.DirectorySeparatorChar}";

            fileName += $"{Path.GetFileNameWithoutExtension(_Model.PdfPath)}{fileSufix}";
            fileName += $"{Path.GetExtension(_Model.PdfPath)}";


            Util.PrintRectangles(_Model.PdfPath, fileName, patterns);

            wBr.Navigate(fileName);
        }
        public override void Terminate()
        {
            GlobalWindowManager.WindowAdded -= WindowAddedHandler;

            ctxItem.GetCurrentParent().Items.Remove(ctxItem);
            ctxItem.Dispose();
            ctxItem = null;
        }
Exemple #19
0
        //获取右键点击的台位
        private Seat getContextSenderSeat(BathDBDataContext db_new, object sender)
        {
            ToolStripMenuItem item  = sender as ToolStripMenuItem;
            ContextMenuStrip  cmenu = item.GetCurrentParent() as ContextMenuStrip;
            Button            bt    = cmenu.SourceControl as Button;

            return(db_new.Seat.FirstOrDefault(x => x.text == bt.Text));
        }
        //-----------------------------------------------------------------------------------------------------------------------------------------------------
        private void printToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem menuItem  = (ToolStripMenuItem)sender;
            ContextMenuStrip  menuStrip = (ContextMenuStrip)menuItem.GetCurrentParent();
            Chart             cht       = (Chart)(menuStrip.SourceControl);

            cht.Printing.Print(true);
        }
Exemple #21
0
        /*
         * 右键关闭对话菜单
         */
        private void toolStripMenuItemClosePreview_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem menu  = sender as ToolStripMenuItem;
            Panel             panel = (menu.GetCurrentParent() as ContextMenuStrip).SourceControl as Panel;

            panel.ContextMenuStrip = null;
            m_sdkOperator.Dialog.closeBrowse(panel);
        }
Exemple #22
0
        private void HandleMenuItem(object sender, EventArgs arg)
        {
            ToolStripMenuItem item    = (ToolStripMenuItem)sender;
            var      contextMenuStrip = (ContextMenuStrip)item.GetCurrentParent();
            TreeView srcView          = GetFormFromMenu(contextMenuStrip);
            string   connectionString = SelectedNodeConnectionString(srcView);

            Clipboard.SetText(connectionString);
        }
Exemple #23
0
        public static void CheckAndUncheckSiblings(this ToolStripMenuItem toolStripMenuItem)
        {
            var parent = (ToolStripDropDownMenu)toolStripMenuItem.GetCurrentParent();

            foreach (ToolStripMenuItem sibling in parent.Items)
            {
                sibling.CheckState = sibling == toolStripMenuItem ? CheckState.Checked : CheckState.Unchecked;
            }
        }
        private void progressContextCancelToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem menuItem    = (ToolStripMenuItem)sender;
            ContextMenuStrip  menuStrip   = (ContextMenuStrip)menuItem.GetCurrentParent();
            ProgressBar       progressBar = (ProgressBar)menuStrip.Tag;
            ProgressContext   progress    = (ProgressContext)progressBar.Tag;

            progress.Cancel = true;
        }
Exemple #25
0
        //右键下班
        private void  班ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem item  = sender as ToolStripMenuItem;
            ContextMenuStrip  cmenu = item.GetCurrentParent() as ContextMenuStrip;
            Button            bt    = cmenu.SourceControl as Button;

            var dc   = new BathDBDataContext(m_connectionString);
            var user = dc.Employee.FirstOrDefault(x => x.id == bt.Name);

            if (user == null)
            {
                return;
            }

            var           tech_index = dao.get_techIndex("select * from [TechIndex] where dutyid=" + user.jobId);
            List <string> old_index  = null;

            if (tech_index != null)
            {
                old_index = tech_index.ids.Split('%').ToList();
            }

            string cmd_str = "";

            if (user.techStatus != "下班")
            {
                if (user.techStatus != null && user.techStatus != "空闲")
                {
                    if (BathClass.printAskMsg("技师正在上钟,确认下班?") != DialogResult.Yes)
                    {
                        return;
                    }
                }
                cmd_str = "update [Employee] set techStatus='下班' where id='" + user.id + "'";
                if (tech_index != null)
                {
                    old_index.Remove(user.id);
                    cmd_str += " update [techIndex] set ids='" + string.Join("%", old_index.ToArray()) + "' where id=" + tech_index.id;
                }
            }
            else
            {
                cmd_str = "update [Employee] set techStatus='空闲',startTime=null, seat=null,serverTime=null,room=null,OrderClock=null" +
                          " where id='" + user.id + "'";
                if (tech_index != null)
                {
                    old_index.Add(user.id);
                    cmd_str += " update [techIndex] set ids='" + string.Join("%", old_index.ToArray()) + "' where id=" + tech_index.id;
                }
            }

            if (!dao.execute_command(cmd_str))
            {
                BathClass.printErrorMsg("技师上下班失败!");
                return;
            }
        }
Exemple #26
0
        private void eliminaPrenotazioneToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem t   = (ToolStripMenuItem)sender;
            ListViewItem      lvi = (ListViewItem)t.GetCurrentParent().Tag;
            Prenotazione      p   = (Prenotazione)lvi.Tag;

            LocaleRistorazione.GetInstance().ListaPrenotazioni.Remove(p);
            MessageBox.Show("Cancellazione Effettuata", "Elimina");
        }
Exemple #27
0
        private void ShowItemMenu(ToolStripMenuItem menu)
        {
            var parent = ((ToolStripDropDown)menu.GetCurrentParent()).OwnerItem;

            if (!parent.Visible)
            {
                parent.Visible = true;
            }
            menu.Visible = true;
        }
Exemple #28
0
        private void ActivitySetupMenu_Click(object sender, EventArgs e)
        {
            FieldActivity     activity = null;
            ToolStripMenuItem item     = null;

            if (sender != null)
            {
                item     = (ToolStripMenuItem)sender;
                activity = (FieldActivity)item.Tag;
            }
            else
            {
                activity = _SetupActivity;
                foreach (var child in SetupMenu.DropDownItems)
                {
                    if (((ToolStripMenuItem)child).Tag == activity)
                    {
                        item = (ToolStripMenuItem)child;
                        break;
                    }
                }
            }

            if (activity.ActivityMode != ActivityMode.Ready)
            {
                Debug.WriteLine($"{_SetupActivity.Name} already in setup mode - cancel");
                _SetupActivity.ActivityMode = ActivityMode.Ready;
                foreach (var child in item.GetCurrentParent().Items)
                {
                    SetEnabled((ToolStripMenuItem)child, true);
                }
                return;
            }

            foreach (var child in item.GetCurrentParent().Items)
            {
                SetEnabled((ToolStripMenuItem)child, false);
            }

            _SetupActivity = activity;
            StartSetup();
        }
Exemple #29
0
        void menu_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem item = sender as ToolStripMenuItem;                 //转换类型

            ContextMenuStrip strip = item.GetCurrentParent() as ContextMenuStrip; //检索作为当前ToolStripItem的容器
            TreeView         tree  = strip.SourceControl as TreeView;             //获取使ContextMenuStrip此被显示的控件

            tree.SelectedNode.Remove();

            DbConnection.Save(this.treeView.Nodes.Cast <TreeNode>().Select(node => (DbConnection)node.Tag).ToList());
        }
        private void highlight_toolstripmenuitem(ToolStripMenuItem item)
        {
            ToolStrip parent = item.GetCurrentParent();

            if (parent == null)
            {
                return;
            }
            item.BackColor = parent.ForeColor;
            item.ForeColor = parent.BackColor;
        }