Exemple #1
0
        public void ShowMenu()
        {
            ContextMenuStrip cms = new ContextMenuStrip
            {
                Font            = new Font("Arial", 10f),
                AutoClose       = false,
                ShowImageMargin = false
            };

            if (Program.Settings != null && Program.Settings.QuickTaskPresets != null && Program.Settings.QuickTaskPresets.Count > 0)
            {
                foreach (QuickTaskInfo taskInfo in Program.Settings.QuickTaskPresets)
                {
                    if (taskInfo.IsValid)
                    {
                        ToolStripMenuItem tsmi = new ToolStripMenuItem {
                            Text = taskInfo.ToString().Replace("&", "&&"), Tag = taskInfo
                        };
                        tsmi.Click += (sender, e) =>
                        {
                            QuickTaskInfo selectedTaskInfo = ((ToolStripMenuItem)sender).Tag as QuickTaskInfo;
                            cms.Close();
                            OnTaskInfoSelected(selectedTaskInfo);
                        };
                        cms.Items.Add(tsmi);
                    }
                    else
                    {
                        cms.Items.Add(new ToolStripSeparator());
                    }
                }

                cms.Items[0].Select();

                cms.Items.Add(new ToolStripSeparator());
            }

            // Translate
            ToolStripMenuItem tsmiEdit = new ToolStripMenuItem("Edit this menu...");

            tsmiEdit.Click += (sender, e) =>
            {
                cms.Close();
                new QuickTaskMenuEditorForm().ShowDialog();
            };
            cms.Items.Add(tsmiEdit);

            cms.Items.Add(new ToolStripSeparator());

            ToolStripMenuItem tsmiCancel = new ToolStripMenuItem("Cancel");

            tsmiCancel.Click += (sender, e) => cms.Close();
            cms.Items.Add(tsmiCancel);

            Point cursorPosition = CaptureHelpers.GetCursorPosition();

            cursorPosition.Offset(-10, -10);
            cms.Show(cursorPosition);
        }
        public static ContextMenuStrip CreateCodesMenu(TextBox tb, params ReplacementVariables[] ignoreList)
        {
            ContextMenuStrip cms = new ContextMenuStrip
            {
                Font            = new XmlFont("Lucida Console", 8),
                AutoClose       = false,
                Opacity         = 0.8,
                ShowImageMargin = false
            };

            var variables = Enum.GetValues(typeof(ReplacementVariables)).Cast <ReplacementVariables>().Where(x => !ignoreList.Contains(x)).
                            Select(x => new
            {
                Name        = ReplacementExtension.Prefix + Enum.GetName(typeof(ReplacementVariables), x),
                Description = x.GetDescription(),
                Enum        = x
            });

            foreach (var variable in variables)
            {
                ToolStripMenuItem tsi = new ToolStripMenuItem {
                    Text = string.Format("{0} - {1}", variable.Name, variable.Description), Tag = variable.Name
                };
                tsi.Click += (sender, e) =>
                {
                    string text = ((ToolStripMenuItem)sender).Tag.ToString();
                    tb.AppendTextToSelection(text);
                };
                cms.Items.Add(tsi);
            }

            tb.MouseDown += (sender, e) =>
            {
                if (cms.Items.Count > 0)
                {
                    cms.Show(tb, new Point(tb.Width + 1, 0));
                }
            };

            tb.Leave += (sender, e) =>
            {
                if (cms.Visible)
                {
                    cms.Close();
                }
            };

            tb.KeyDown += (sender, e) =>
            {
                if ((e.KeyCode == Keys.Enter || e.KeyCode == Keys.Escape) && cms.Visible)
                {
                    cms.Close();
                    e.SuppressKeyPress = true;
                }
            };

            return(cms);
        }
Exemple #3
0
        public static ContextMenuStrip CreatePickerMenu(bool addDynamics, ISurface surface, ICaptureDetails captureDetails, IEnumerable <IDestination> destinations)
        {
            ContextMenuStrip menu = new ContextMenuStrip();

            menu.Closing += delegate(object source, ToolStripDropDownClosingEventArgs eventArgs) {
                LOG.DebugFormat("Close reason: {0}", eventArgs.CloseReason);
                if (eventArgs.CloseReason != ToolStripDropDownCloseReason.ItemClicked && eventArgs.CloseReason != ToolStripDropDownCloseReason.CloseCalled)
                {
                    eventArgs.Cancel = true;
                }
            };
            foreach (IDestination destination in destinations)
            {
                // Fix foreach loop variable for the delegate
                ToolStripMenuItem item = destination.GetMenuItem(addDynamics,
                                                                 delegate(object sender, EventArgs e) {
                    ToolStripMenuItem toolStripMenuItem = sender as ToolStripMenuItem;
                    if (toolStripMenuItem == null)
                    {
                        return;
                    }
                    IDestination clickedDestination = (IDestination)toolStripMenuItem.Tag;
                    if (clickedDestination == null)
                    {
                        return;
                    }
                    // Make sure the menu is closed
                    menu.Close();
                    bool result = clickedDestination.ExportCapture(true, surface, captureDetails);
                    // TODO: Find some better way to detect that we exported to the editor
                    if (!EditorDestination.DESIGNATION.Equals(clickedDestination.Designation) || result == false)
                    {
                        LOG.DebugFormat("Disposing as Destination was {0} and result {1}", clickedDestination.Description, result);
                        // Cleanup surface
                        surface.Dispose();
                    }
                }
                                                                 );
                if (item != null)
                {
                    menu.Items.Add(item);
                }
            }
            // Close
            menu.Items.Add(new ToolStripSeparator());
            ToolStripMenuItem closeItem = new ToolStripMenuItem(Language.GetString(LangKey.editor_close));

            closeItem.Image  = ((System.Drawing.Image)(new System.ComponentModel.ComponentResourceManager(typeof(ImageEditorForm)).GetObject("closeToolStripMenuItem.Image")));
            closeItem.Click += delegate {
                // This menu entry is the close itself, we can dispose the surface
                menu.Close();
                // Dispose as the close is clicked
                surface.Dispose();
            };
            menu.Items.Add(closeItem);

            return(menu);
        }
Exemple #4
0
        private void ShowFullVersionPopup()
        {
            appMenu.Close();
            aboutMenuItem.Enabled = false;

            if (MessageBox.Show("Enjoying HandsOff's trial version?\n\nPlease consider purchasing the full version, which is free of this annoying popup and can also be setup to run on startup.\n\nIt's only $1.89, and you'll help support the development of awesome software!\n\nReady for the full version?", "HandsOff Full", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
            {
                Process.Start("http://www.secretfloor.com");
            }

            aboutMenuItem.Enabled = true;
        }
Exemple #5
0
        void TextBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode != Keys.Enter)
            {
                return;
            }
            e.Handled = e.SuppressKeyPress = true;
            string typed = this.LabeledTextBoxControl.TextBox.Text;

            typed = typed.Trim();
            typed = typed.Replace('\'', '~');                   //  no single quotes against future SQL-injection: update name='456~~; DELETE *;'
            typed = typed.Replace('"', '~');                    //  no double quotes for current JSON consistency: "ScriptContextsByName": { "456~~": {} }
            var args = new LabeledTextBoxUserTypedArgs(typed);

            if (this.UserTyped != null)
            {
                this.UserTyped(this, args);
            }
            this.LabeledTextBoxControl.TextRed = args.HighlightTextWithRed;
            if (args.RootHandlerShouldCloseParentContextMenuStrip == false)
            {
                return;
            }
            ContextMenuStrip ctx = this.Owner as ContextMenuStrip;

            if (ctx == null)
            {
                return;
            }
            ctx.Close();
        }
Exemple #6
0
        public static void ShowIconMenu <T>(Point position, IEnumerable <Tuple <T, Bitmap> > items, Action <T> pickHandler)
        {
            List <Tuple <T, Bitmap> > itemList = items?.OrderBy(item => item.Item1.ToString()).ToList();

            if (itemList == null || !itemList.Any())
            {
                return;
            }

            ContextMenuStrip contextMenu = new ContextMenuStrip();
            ToolStripDropDownClosedEventHandler contextMenuClosedEventHandler = null;
            ToolStripItemClickedEventHandler    menuItemClickedEventHandler   = null;

            contextMenuClosedEventHandler = (sender, e) =>
            {
                contextMenu.Closed      -= contextMenuClosedEventHandler;
                contextMenu.ItemClicked -= menuItemClickedEventHandler;
            };
            menuItemClickedEventHandler = (sender, e) =>
            {
                contextMenu.Closed      -= contextMenuClosedEventHandler;
                contextMenu.ItemClicked -= menuItemClickedEventHandler;
                contextMenu.Close();
                pickHandler((T)e.ClickedItem.Tag);
            };
            contextMenu.Closed      += contextMenuClosedEventHandler;
            contextMenu.ItemClicked += menuItemClickedEventHandler;
            itemList.ForEach(item => contextMenu.Items.Add(new ToolStripMenuItem(item.Item1.ToString())
            {
                Tag = item.Item1, Image = item.Item2
            }));
            contextMenu.Show(position);
        }
Exemple #7
0
 private void listFiles_RightClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         listboxContextMenu.Close();
         int index = this.listFiles.IndexFromPoint(e.Location);
         if (index != ListBox.NoMatches)
         {
             listFiles.SelectedIndex = index;
         }
         if (listFiles.SelectedIndex != -1)
         {
             listboxContextMenu.Show();
         }
     }
 }
Exemple #8
0
        public static ContextMenuStrip Create <TEntry>(params TEntry[] ignoreList) where TEntry : CodeMenuEntry
        {
            ContextMenuStrip cms = new ContextMenuStrip
            {
                Font            = new Font("Lucida Console", 8),
                AutoClose       = true,
                Opacity         = 0.9,
                ShowImageMargin = false
            };

            var variables = Helpers.GetValueFields <TEntry>().Where(x => !ignoreList.Contains(x)).
                            Select(x => new
            {
                Name        = x.ToPrefixString(),
                Description = x.Description
            });

            foreach (var variable in variables)
            {
                ToolStripMenuItem tsmi = new ToolStripMenuItem {
                    Text = string.Format("{0} - {1}", variable.Name, variable.Description), Tag = variable.Name
                };
                cms.Items.Add(tsmi);
            }

            cms.Items.Add(new ToolStripSeparator());

            ToolStripMenuItem tsmiClose = new ToolStripMenuItem(Resources.CodeMenu_Create_Close);

            tsmiClose.Click += (sender, e) => cms.Close();
            cms.Items.Add(tsmiClose);

            return(cms);
        }
Exemple #9
0
        ContextMenuStrip CreateMenu(XGEffectBlockType type)
        {
            ContextMenuStrip   strip     = new ContextMenuStrip();
            EffectSelectorMenu container = new EffectSelectorMenu();

            strip.Items.Add(container);

            for (int i = 0; i < XGEffect.AllEffects.Count; i++)
            {
                XGEffect efct = XGEffect.AllEffects[i];
                if (type >= XGEffectBlockType.Variation ||
                    (type == XGEffectBlockType.Reverb && efct.SelectableForReverb) ||
                    (type == XGEffectBlockType.Chorus && efct.SelectableForChorus))
                {
                    container.AddButton(XGEffect.AllEffects[i].Name,
                                        XGEffect.AllEffects[i].Description,
                                        () => { strip.Close(); DecideEffect(type, efct); },
                                        efct.SelectableForReverb & efct.SelectableForChorus ? Color.DarkGray :
                                        efct.SelectableForReverb?Color.Maroon:
                                        efct.SelectableForChorus ? Color.Teal :
                                        Color.Navy
                                        );
                }
            }
            strip.LayoutStyle = ToolStripLayoutStyle.Flow;

            return(strip);
        }
        private void ExitAction(object sender, EventArgs e)
        {
            NotifMenu.Close();
            NotifIcon.Visible = false;

            Environment.Exit(1);
        }
Exemple #11
0
        void _LocalsGrid_MouseUp_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            ContextMenuStrip senderMenu = (ContextMenuStrip)sender;
            DataGridViewRow  clickedRow = (DataGridViewRow)senderMenu.Tag;

            senderMenu.Close();

            switch (e.ClickedItem.Text)
            {
            case "Copy":
                System.Text.StringBuilder text = new StringBuilder();
                foreach (DataGridViewCell cell in clickedRow.Cells)
                {
                    text.Append(cell.Value.ToString() + "\t");
                }
                text.Length--;     //Remove trailing [tab].
                Clipboard.SetText(text.ToString());
                break;

            case "Copy Value":
                Clipboard.SetText(clickedRow.Cells["Value"].Value.ToString());
                break;

            case "Delete":
                _LocalsGrid.Rows.Remove(clickedRow);
                break;

            case "Cancel":
                break;
            }
        }
        public void ListSelectBegin(bool isPicker)
        {
            var Map = MainMap;
            var MouseOverTerrain = Map.ViewInfo.GetMouseOverTerrain();

            if (MouseOverTerrain == null)
            {
                Debugger.Break();
                return;
            }

            var a = 0;

            listSelect.Close();
            listSelect.Items.Clear();
            listSelectItems = new ToolStripItem[MouseOverTerrain.Units.Count];
            for (a = 0; a <= MouseOverTerrain.Units.Count - 1; a++)
            {
                var unit = MouseOverTerrain.Units[a];
                listSelectItems[a]     = new ToolStripButton(unit.TypeBase.GetDisplayTextCode());
                listSelectItems[a].Tag = unit;
                listSelect.Items.Add(listSelectItems[a]);
            }
            listSelectIsPicker = isPicker;
            listSelect.Show(this, new Point(Map.ViewInfo.MouseOver.ScreenPos.X, Map.ViewInfo.MouseOver.ScreenPos.Y));
        }
        /*PluginRegionLocator _pluginRegionLocator = null;
         *
         * private void MenuVideoCropperClickHandler(object sender, EventArgs args){
         *  CommonClickHandler();
         *
         *  var tsi = (ToolStripMenuItem)sender;
         *  var handle = (WindowHandle)tsi.Tag;
         *
         *  if (_pluginRegionLocator == null)
         *      _pluginRegionLocator = new PluginRegionLocator();
         *
         *  var detectedRegion = _pluginRegionLocator.LocatePluginRegion(handle);
         *  _owner.SetThumbnail(handle, detectedRegion);
         * }*/

        private void CommonClickHandler()
        {
            _windowsMenu.Close();
            foreach (ContextMenuStrip menu in _parentMenus)
            {
                menu.Close();
            }
        }
Exemple #14
0
        private void Form1_MouseDown(object sender, MouseEventArgs e)
        {
            scoreBoardContextMenu.Close();
            if (e.Button == MouseButtons.Right)
            {
                try
                {
                    mspt = e.Location;
                    int pos = 0;
                    for (int p = 0; p < 25; p++)
                    {
                        System.Drawing.Rectangle selection = new System.Drawing.Rectangle(0, 45 + (21 * pos), 900, 21);

                        if (selection.Contains(mspt))
                        {
                            contextPlayerPos = p;
                        }
                        pos += 1;
                    }

                    if (currentConnection.server.serverData.Players.Count >= contextPlayerPos)
                    {
                        int x = 0;
                        for (int t = 0; t < currentConnection.server.prevteamlist.Count; t++)
                        {
                            Team team = currentConnection.server.prevteamlist[t];
                            if (team != null && team.GetPlayers() != null && team.GetPlayers().Count > 0)
                            {
                                for (int p = 0; p < team.GetPlayers().Count; p++)
                                {
                                    PlayerInfo ps = team.GetPlayers()[p];
                                    System.Drawing.Rectangle selection = new System.Drawing.Rectangle(0, 45 + (21 * x), 900, 20);

                                    if (selection.Contains(mspt))
                                    {
                                        newContextPlayer = ps;
                                    }
                                    x += 1;
                                }
                            }
                        }

                        contextplayer = newContextPlayer;

                        if (contextplayer != null && !contextplayer.Name.Equals(""))
                        {
                            scoreBoardContextMenu.Items[0].Text = "&Kick " + contextplayer.Name;
                            scoreBoardContextMenu.Items[1].Text = "&Ban " + contextplayer.Name;

                            this.scoreBoardContextMenu.Show(this, new Point(e.X, e.Y));
                        }
                    }
                }catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
 private void shapeItem_MouseLeave(object sender, EventArgs e)
 {
     if (_startDragDrop)
     {
         _startDragDrop = false;
         DoDragDrop((sender as CSharpFramework.EditorManager.PluginToolStripMenuItem).m_plugin, DragDropEffects.Copy | DragDropEffects.Scroll);
         recentShapesContextMenu.Close();
     }
 }
Exemple #16
0
 public static void Destroy()
 {
     if (m_ctx != null)
     {
         m_ctx.Close();
         m_ctx.Dispose();
         m_ctx = null;
     }
 }
Exemple #17
0
 public void Dispose()
 {
     gIcon.Visible = false;
     gIcon.Icon    = null;
     gMenu.Close();
     gToolTip.Dispose();
     gMenu.Dispose();
     gIcon.Dispose();
     Application.DoEvents();
     GC.Collect();
 }
Exemple #18
0
 /// <summary>
 /// Script menu response.
 /// </summary>
 /// <param name="sender">Not used.</param>
 /// <param name="e">Selected option.</param>
 void ScriptMenu(object sender, ToolStripItemClickedEventArgs e)
 {
     script_menu.Close();
     for (int item = 0; item < SCRIPT_MENU.Length; item++)
     {
         if (e.ClickedItem.ToString() == SCRIPT_MENU[item])
         {
             SCRIPT_MENU_ACTIONS[item]();
         }
     }
 }
Exemple #19
0
 private void Button1_Click(System.Object sender, System.EventArgs e)
 {
     for (int x = 0; x <= ListBox1.Items.Count - 1; x++)
     {
         if (ListBox1.GetSelected(x))
         {
             int tempX = x;
             ((checkHideColumnHeaderCell)dgv.Columns[Array.FindIndex(dgv.Columns.Cast <DataGridViewColumn>().ToArray(), c => c.HeaderText.Trim().Equals(ListBox1.GetItemText(ListBox1.Items[tempX])))].HeaderCell).isChecked = true;
         }
     }
     cms.Close();
 }
Exemple #20
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (lastShownSecondaryContextMenu != null)
         {
             lastShownSecondaryContextMenu.Close();
             lastShownSecondaryContextMenu = null;
         }
     }
     base.Dispose(disposing);
 }
Exemple #21
0
        private void InsertButton_Click(object sender, EventArgs e)
        {
            ContextMenuStrip.Close();

            using (FormKeywords dialog = new FormKeywords()) {
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    string keyword = YoutubeDLApi.KeywordTemplate.Replace("{keyword}", dialog.SelectedKeyword.Value);
                    InsertKeyword(keyword);
                }
            }
        }
Exemple #22
0
        protected override void InitializeCore()
        {
            // get the theme from the current application
            var theme = ThemeManager.DetectAppStyle(Application.Current);

            // now set the Green accent and dark theme
            ThemeManager.ChangeAppStyle(Application.Current,
                                        ThemeManager.GetAccent(AppConfig.AccentColor),
                                        ThemeManager.GetAppTheme(AppConfig.AppTheme));

            _explorerCleaner          = new ExplorerCleaner(AppConfig);
            _explorerCleaner.Cleaned += (sender, args) => OnCleaned(args);
            _actionExecuter           =
                new ActionExecuter <ExplorerWindowCleanerClientOperator>(new ExplorerWindowCleanerClientOperator(this,
                                                                                                                 _explorerCleaner));
            DisposableCollection.Add(_actionExecuter);
            ResetBackgroundWorker(AppConfig.Interval, new BackgroundAction[] { new CleanerAction(this) });

            if (AppConfig.IsMouseHook)
            {
                RestoreClipboardHistories();

                MonitoringClipboard();

                CreateShortcutContextMenu();
                CreateClipboardContextMenu();

                _globalMouseHook              = new GlobalMouseHook();
                _globalMouseHook.MouseHooked += (sender, args) =>
                {
                    if (args.MouseButton == MouseButtons.Left)
                    {
                        _contextMenuClipboardHistories.Close(ToolStripDropDownCloseReason.AppFocusChange);
                        _contextMenuShortcuts.Close(ToolStripDropDownCloseReason.AppFocusChange);
                    }

                    if (args.IsDoubleClick)
                    {
                        if (args.MouseButton == MouseButtons.Right)
                        {
                            _contextMenuClipboardHistories.Tag = GetForegroundWindow();
                            _contextMenuClipboardHistories.Show(args.Point);
                        }
                        else if (args.MouseButton == MouseButtons.Left && args.IsDesktop)
                        {
                            _contextMenuShortcuts.Show(args.Point);
                            Debug.WriteLine($"Show Shortcut Menu. {args.Point}");
                        }
                        Debug.WriteLine("DoubleClick Mouse.");
                    }
                };
            }
        }
Exemple #23
0
        public static void ShowMenu <T1, T2>(Point position, IEnumerable <T1> rootItems, IEnumerable <T2> items, Action <T1, T2> pickHandler)
        {
            IEnumerable <T1> rootItemList = rootItems as IList <T1> ?? rootItems?.ToList();

            if (rootItemList == null || !rootItemList.Any())
            {
                return;
            }

            List <T2> itemList = items?.OrderBy(item => item.ToString()).ToList();

            if (itemList == null || !itemList.Any())
            {
                return;
            }

            ContextMenuStrip contextMenu = new ContextMenuStrip();

            foreach (T1 rootItem in rootItemList)
            {
                ToolStripMenuItem rootMenuItem = new ToolStripMenuItem(rootItem.ToString())
                {
                    Tag = rootItem
                };
                contextMenu.Items.Add(rootMenuItem);
                itemList.ForEach(item => rootMenuItem.DropDownItems.Add(new ToolStripMenuItem(item.ToString())
                {
                    Tag = new Tuple <T1, T2>(rootItem, item)
                }));
            }

            ToolStripDropDownClosedEventHandler contextMenuClosedEventHandler = null;
            ToolStripItemClickedEventHandler    menuItemClickedEventHandler   = null;

            contextMenuClosedEventHandler = (sender, e) =>
            {
                contextMenu.Closed -= contextMenuClosedEventHandler;
                contextMenu.Items.Cast <ToolStripMenuItem>().ToList().ForEach(x => x.DropDownItemClicked -= menuItemClickedEventHandler);
            };
            menuItemClickedEventHandler = (sender, e) =>
            {
                contextMenu.Closed -= contextMenuClosedEventHandler;
                contextMenu.Items.Cast <ToolStripMenuItem>().ToList().ForEach(x => x.DropDownItemClicked -= menuItemClickedEventHandler);
                contextMenu.Close();
                Tuple <T1, T2> tag = (Tuple <T1, T2>)e.ClickedItem.Tag;
                pickHandler(tag.Item1, tag.Item2);
            };
            contextMenu.Closed += contextMenuClosedEventHandler;
            contextMenu.Items.Cast <ToolStripMenuItem>().ToList().ForEach(x => x.DropDownItemClicked += menuItemClickedEventHandler);
            contextMenu.Show(position);
        }
Exemple #24
0
        protected override void OnMouseWheel(MouseEventArgs e)
        {
            if (map == null)
            {
                return;
            }

            // sometimes map control is focused even when mouse is outside - then skip it
            if (e.X < 0 || e.Y < 0 || e.X > Width || e.Y > Height)
            {
                return;
            }

            var mousePosition = map.ImageToWorld(new Point(e.X, e.Y));

            if (_cmStrip?.Visible ?? false)
            {
                _cmStrip.Close();
                _cmStrip = null;
            }

            WithActiveToolsDo(tool => tool.OnMouseWheel(mousePosition, e));
            base.OnMouseWheel(e);
        }
Exemple #25
0
        private void cMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            ContextMenuStrip m = (ContextMenuStrip)sender;

            DevExpress.XtraGrid.GridControl grid = (DevExpress.XtraGrid.GridControl)m.SourceControl;
            m.Close();

            GridView view = grid.DefaultView as GridView;

            int[] selRowsPost = view.GetSelectedRows();
            int   count       = 0;
            bool  i           = false;

            bool changeCursor = Cursor.Current != Cursors.WaitCursor;

            if (changeCursor)
            {
                Cursor.Current = Cursors.WaitCursor;
            }

            foreach (int r in selRowsPost)
            {
                DataRow row = gridView1.GetDataRow(r);
                count++;
                tStatus.Text = string.Format("Обработка заказа {0} ({1}/{2})", row[1], count, selRowsPost.Length);
                Application.DoEvents();
                switch (e.ClickedItem.Name)
                {
                case "EditAddressItem":
                    (new FormAddressNew(row["OrderCode"].ToString())).ShowDialog();
                    break;

                case "ShipBoxItem":
                    i = ShipBox(row["OrderCode"].ToString());
                    break;

                case "showInfo":
                    (new FormInfo(row["OrderCode"].ToString())).ShowDialog();
                    break;
                }
            }
            if (changeCursor)
            {
                Cursor.Current = Cursors.Default;
            }
            tStatus.Text = "Готов";
            DataFill();
        }
Exemple #26
0
        private void DataViewCellClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            string           temp      = "";
            ContextMenuStrip menuStrip = (ContextMenuStrip)sender;
            DataGridView     view      = (DataGridView)menuStrip.SourceControl;

            menuStrip.Close();

            switch (e.ClickedItem.Tag.ToString())
            {
            case "Copy cell":
                temp = view.SelectedCells[0].Value.ToString();
                Clipboard.SetText(temp);
                break;

            case "Copy selected":
                foreach (DataGridViewCell cell in view.SelectedCells)
                {
                    temp += cell.Value + ";";
                    Clipboard.SetText(temp);
                }
                break;

            case "Open in browser":
                List <int> openedRows = new List <int>();
                foreach (DataGridViewCell cell in view.SelectedCells)
                {
                    if (openedRows.Contains(cell.RowIndex))
                    {
                        continue;
                    }
                    openedRows.Add(cell.RowIndex);
                    temp = view.Rows[cell.RowIndex].Cells[0].Value.ToString();
                    Process.Start(temp);
                }
                break;

            case "Save to csv":
                SaveRowsToCsv(view);
                break;

            default:
                temp  = view.SelectedCells[0].Value.ToString();
                temp += "\n" + e.ClickedItem.Tag;
                MessageBox.Show(temp, "Error");
                break;
            }
        }
Exemple #27
0
        private void myMenuStripItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            myMenuStrip.Close();

            int index = myMenuStrip.Items.IndexOf(e.ClickedItem);

            if (index == myMenuStrip.Items.Count - 1)
            {
                //del
                onDelItems();
            }
            else
            {
                //set group
                onSetCategory(index + 1);
            }
        }
Exemple #28
0
        /// <summary>
        /// 快捷菜单点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void contextMenuStripWrite_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            ListView         listView  = null;
            ContextMenuStrip menuStrip = sender as ContextMenuStrip;

            if (menuStrip != null)
            {
                listView = menuStrip.SourceControl as ListView;
                if (listView == null)
                {
                    return;
                }
            }
            menuStrip.Close();
            menuStrip.Refresh();
            switch (e.ClickedItem.Name)
            {
            case "WriteCleanToolStripMenuItem":
                CleanWriteConfig();
                break;

            case "WriteImportToolStripMenuItem":
                InputWriteConfig();
                break;

            case "WriteOutputToolStripMenuItem":
                OutputWriteConfig();
                break;

            case "WriteDeleteToolStripMenuItem":
                DeleteWriteConfig(listView);
                break;

            case "WriteUpToolStripMenuItem":
                MoveWriteConfig(listView, true);
                break;

            case "WriteDownToolStripMenuItem":
                MoveWriteConfig(listView, false);
                break;

            default:
                break;
            }
        }
Exemple #29
0
        private void oMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            oMenu.Close();
            switch (e.ClickedItem.Text)
            {
            case "Exportar":
                this.Exportar();
                break;

            case "Refrescar":
                this.Refresh(sender, e);
                break;

            case "Definir Busqueda":
                this.CriterioBusqueda(sender, e);
                break;
            }
        }
Exemple #30
0
        private void OnLogsFilesBoxClicked(object sender, EventArgs e)
        {
            if (e is MouseEventArgs mouse && mouse.Button == MouseButtons.Left && logs.SelectedItems.Count > 0)
            {
                ContextMenuStrip cms          = sender as ContextMenuStrip;
                object           selectedItem = logs.SelectedItem;

                var toolStripItem = cms?.GetItemAt(mouse.Location);
                if (toolStripItem != null)
                {
                    if (toolStripItem.Text == "Open in file explorer")
                    {
                        try {
                            string si = selectedItem.ToString();
                            System.Diagnostics.Process.Start("explorer.exe", File.Exists(si) ? new FileInfo(si).DirectoryName : si);
                        } catch (Exception ex) {
                            LogException(ex.Message + " " + ex.StackTrace);
                            MessageBox.Show("File not found", "The file to open does not exist: " + ex.Message, MessageBoxButtons.OK);
                        }
                    }
                    else if (toolStripItem.Text == "Remove")
                    {
                        logs.Items.Remove(selectedItem);

                        string si = selectedItem.ToString();
                        if (Directory.Exists(si))
                        {
                            Directory.Delete(si, true);
                        }
                        else if (File.Exists(si))
                        {
                            File.Delete(si);
                        }
                    }
                }

                if (cms != null)
                {
                    cms.Close();
                }

                logs.SelectedItems.Clear();
            }
        }