private void ContextMenu_ContextMenuOpening(object sender, System.Windows.Controls.ContextMenuEventArgs e)
        {
            // disable certain menu items if no map selected
            bool isMapSelected      = (lstMaps.SelectedItem != null);
            bool isSessionPathValid = SessionPath.IsSessionPathValid();

            menuReimporSelectedMap.IsEnabled    = isMapSelected;
            menuOpenSelectedMapFolder.IsEnabled = isMapSelected;
            menuRenameSelectedMap.IsEnabled     = isMapSelected;
            menuHideSelectedMap.IsEnabled       = isMapSelected;

            menuOpenSessionFolder.IsEnabled = isSessionPathValid;
            menuOpenMapsFolder.IsEnabled    = isSessionPathValid;

            if (isMapSelected)
            {
                MapListItem selected          = (lstMaps.SelectedItem as MapListItem);
                bool        hasImportLocation = MetaDataManager.IsImportLocationStored(selected);
                menuReimporSelectedMap.IsEnabled = hasImportLocation;
                menuReimporSelectedMap.ToolTip   = hasImportLocation ? null : "You can only re-import if you imported the map from 'Import Map > From Computer ...' and imported a folder.\n(does not work with .zip files)";
                menuHideSelectedMap.Header       = selected.IsHiddenByUser ? "Show Selected Map ..." : "Hide Selected Map ...";

                bool canBeDeleted = MetaDataManager.HasPathToMapFilesStored(selected);
                menuDeleteSelectedMap.IsEnabled = canBeDeleted;
                menuDeleteSelectedMap.ToolTip   = canBeDeleted ? null : "You can only delete a map that has been imported via version 2.2.3 or greater.";
            }
        }
        private void Grid_ContextMenuOpening(object sender, System.Windows.Controls.ContextMenuEventArgs e)
        {
            FrameworkElement fe = e.Source as FrameworkElement;

            if (fe.DataContext is DataItem)
            {
                if (fe.ContextMenu == null)
                {
                    e.Handled             = true;
                    fe.ContextMenu        = ((DataItem)fe.DataContext).CreateContextMenu();
                    fe.ContextMenu.IsOpen = true;
                }
                else
                {
                    fe.ContextMenu = ((DataItem)fe.DataContext).CreateContextMenu();
                }
            }
            else if (fe.DataContext is XmlDataViewItem)
            {
                if (fe.ContextMenu == null)
                {
                    e.Handled             = true;
                    fe.ContextMenu        = ((XmlDataViewItem)fe.DataContext).DataItem.CreateContextMenu();
                    fe.ContextMenu.IsOpen = true;
                }
                else
                {
                    fe.ContextMenu = ((XmlDataViewItem)fe.DataContext).DataItem.CreateContextMenu();
                }
            }
            else
            {
                throw new Exception("Unknown dataitem type!");
            }
        }
Example #3
0
        private static void DataGrid_ContextMenuOpening(object sender, System.Windows.Controls.ContextMenuEventArgs e)
        {
            bool isCell = IsCell((DependencyObject)e.OriginalSource);

            if (!isCell)
            {
                e.Handled = true;
            }
        }
Example #4
0
 protected override void OnContextMenuOpening(System.Windows.Controls.ContextMenuEventArgs e)
 {
     if (IsVisible)
     {
         e.Handled = true;
         return;
     }
     base.OnContextMenuOpening(e);
 }
        private void TableFilters_ContextMenuOpening(object sender, System.Windows.Controls.ContextMenuEventArgs e)
        {
            var    menuItem = TableFilters.ContextMenu.Items[1] as System.Windows.Controls.MenuItem;
            Filter selected = TableFilters.SelectedItem as Filter;

            if (selected == null)
            {
                return;
            }
            if (selected.Enabled == true)
            {
                menuItem.Header = "Disable";
            }
            else
            {
                menuItem.Header = "Enable";
            }
        }
        private void ContextMenu_ContextMenuOpening(object sender, System.Windows.Controls.ContextMenuEventArgs e)
        {
            // disable certain menu items if no map selected
            bool isMapSelected      = (lstMaps.SelectedItem != null);
            bool isSessionPathValid = ViewModel.IsSessionPathValid();

            menuReimporSelectedMap.IsEnabled    = isMapSelected;
            menuOpenSelectedMapFolder.IsEnabled = isMapSelected;

            menuOpenSessionFolder.IsEnabled = isSessionPathValid;
            menuOpenMapsFolder.IsEnabled    = isSessionPathValid;

            if (isMapSelected)
            {
                MapListItem selected          = (lstMaps.SelectedItem as MapListItem);
                bool        hasImportLocation = MapImporter.IsImportLocationStored(ViewModel.SessionContentPath, selected.DisplayName);
                menuReimporSelectedMap.IsEnabled = hasImportLocation;
                menuReimporSelectedMap.ToolTip   = hasImportLocation ? null : "You can only re-import if you imported the map from 'Import Map > From Computer ...' and imported a folder.\n(does not work with .zip files)";
            }
        }
        private void ContextMenu_ContextMenuOpening(object sender, System.Windows.Controls.ContextMenuEventArgs e)
        {
            // disable certain menu items if no map selected
            bool isMapSelected      = (lstMaps.SelectedItem != null);
            bool isSessionPathValid = SessionPath.IsSessionPathValid();

            menuReimporSelectedMap.IsEnabled    = isMapSelected;
            menuOpenSelectedMapFolder.IsEnabled = isMapSelected;
            menuRenameSelectedMap.IsEnabled     = isMapSelected;
            menuHideSelectedMap.IsEnabled       = isMapSelected;

            menuOpenSessionFolder.IsEnabled = isSessionPathValid;
            menuOpenMapsFolder.IsEnabled    = isSessionPathValid;

            if (isMapSelected)
            {
                MapListItem selected          = (lstMaps.SelectedItem as MapListItem);
                bool        hasImportLocation = MetaDataManager.IsImportLocationStored(selected);
                menuReimporSelectedMap.IsEnabled = hasImportLocation;
                menuReimporSelectedMap.ToolTip   = hasImportLocation ? null : "You can only re-import if you imported the map from 'Import Map > From Computer ...' and imported a folder.\n(does not work with .zip files)";
                menuHideSelectedMap.Header       = selected.IsHiddenByUser ? "Show Selected Map ..." : "Hide Selected Map ...";


                if (ViewModel.SecondMapToLoad == null || ViewModel.SecondMapToLoad?.FullPath != selected.FullPath)
                {
                    menuSecondMapToLoad.Header  = "Set As Second Map To Load (When Leaving Apartment) ...";
                    menuSecondMapToLoad.ToolTip = "Set the map to be loaded after you leave the apartment (before starting the game)";
                }
                else
                {
                    menuSecondMapToLoad.ToolTip = "This will clear the selected map to not load after you leave the apartment";
                    menuSecondMapToLoad.Header  = "Clear As Second Map To Load ...";
                }


                bool canBeDeleted = MetaDataManager.HasPathToMapFilesStored(selected);
                menuDeleteSelectedMap.IsEnabled = canBeDeleted;
                menuDeleteSelectedMap.ToolTip   = canBeDeleted ? null : "You can only delete a map that has been imported via version 2.2.3 or greater.";
            }
        }
Example #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CtxMenu_ContextMenuOpening(object sender, System.Windows.Controls.ContextMenuEventArgs e)
        {
            bool enableLineOps = true;

            if (this.LineCount == 0)
            {
                enableLineOps = false;
            }

            ctxMenuLinesFirst.IsEnabled = enableLineOps;
            ctxMenuLinesLast.IsEnabled  = enableLineOps;
            ctxMenuLinesGoTo.IsEnabled  = enableLineOps;

            if (listLines.SelectedItems.Count > this.config.MultiSelectLimit)
            {
                ctxMenuCopy.IsEnabled           = false;
                ctxMenuExportSelected.IsEnabled = false;
                return;
            }

            ctxMenuCopy.IsEnabled           = true;
            ctxMenuExportSelected.IsEnabled = true;
        }
 protected override void OnContextMenuOpening(System.Windows.Controls.ContextMenuEventArgs e)
 {
 }
Example #10
0
 private void servicenameList_ContextMenuOpening(object sender, System.Windows.Controls.ContextMenuEventArgs e)
 {
 }
Example #11
0
        private void Editor_ContextMenuOpening(object sender, System.Windows.Controls.ContextMenuEventArgs e)
        {
            e.Handled = true;

            var items = new List <KryptonContextMenuItemBase>();

            //Find
            {
                var item = new KryptonContextMenuItem(TranslateContextMenu("Find and Replace"), null,
                                                      delegate(object s, EventArgs e2)
                {
                    SearchReplacePanel?.ShowFindOrReplace(false);
                });
                item.ShortcutKeyDisplayString = EditorActions.ConvertShortcutKeysToString(new Keys[] { Keys.Control | Keys.F });
                //item.ShortcutKeyDisplayString = EditorActions.GetFirstShortcutKeyString( "Find" );
                items.Add(item);
            }

            //separator
            items.Add(new KryptonContextMenuSeparator());

            //Cut
            {
                var item = new KryptonContextMenuItem(TranslateContextMenu("Cut"), EditorResourcesCache.Cut,
                                                      delegate(object s, EventArgs e2)
                {
                    editor.Cut();
                });
                item.ShortcutKeyDisplayString = EditorActions.GetFirstShortcutKeyString("Cut");
                item.Enabled = true;                // editor.CanCut();
                items.Add(item);
            }

            //Copy
            {
                var item = new KryptonContextMenuItem(TranslateContextMenu("Copy"), EditorResourcesCache.Copy,
                                                      delegate(object s, EventArgs e2)
                {
                    editor.Copy();
                });
                item.ShortcutKeyDisplayString = EditorActions.GetFirstShortcutKeyString("Copy");
                item.Enabled = true;                // CanCopy();
                items.Add(item);
            }

            //Paste
            {
                var item = new KryptonContextMenuItem(TranslateContextMenu("Paste"), EditorResourcesCache.Paste,
                                                      delegate(object s, EventArgs e2)
                {
                    editor.Paste();
                });
                item.ShortcutKeyDisplayString = EditorActions.GetFirstShortcutKeyString("Paste");
                item.Enabled = true;                // CanPaste( out _ );
                items.Add(item);
            }

            EditorContextMenu.AddActionsToMenu(EditorContextMenu.MenuTypeEnum.General, items);

            EditorContextMenu.Show(items, this);
        }
 protected virtual new void OnContextMenuOpening(System.Windows.Controls.ContextMenuEventArgs e)
 {
 }
Example #13
0
 private void MainWebView_ContextMenuOpening(object sender, System.Windows.Controls.ContextMenuEventArgs e)
 {
     e.Handled = true;
 }
Example #14
0
 private void Window_ContextMenuOpening(object sender, System.Windows.Controls.ContextMenuEventArgs e)
 {
     logger.InfoFormat("{0:D3}.{1}", ++numberIndex, MethodBase.GetCurrentMethod().Name);
 }
 private void OnTraybarContextMenuOpening(object sender, System.Windows.Controls.ContextMenuEventArgs e)
 {
 }
 private void OnContextMenuOpening(object sender, System.Windows.Controls.ContextMenuEventArgs e)
 {
     e.Handled = !ContextMenuEnabled;
 }
Example #17
0
 protected virtual new void OnContextMenuOpening(System.Windows.Controls.ContextMenuEventArgs e)
 {
     Contract.Requires(e != null);
 }
Example #18
0
 private void TaskbarIcon_ContextMenuOpening(object sender, System.Windows.Controls.ContextMenuEventArgs e)
 {
 }
 private void Grid_ContextMenuClosing(object sender, System.Windows.Controls.ContextMenuEventArgs e)
 {
     /// avoid memory leak
     _videoSource.NewFrame -= VideoCaptureDevice_NewFrame;
     Environment.Exit(0);
 }
Example #20
0
 private void OnlineOutput_Click(object sender, System.Windows.Controls.ContextMenuEventArgs e)
 {
 }
Example #21
0
 private void grdTaskbar_ContextMenuOpening(object sender, System.Windows.Controls.ContextMenuEventArgs e)
 {
     takeFocus();
     CanAutoHide = false;
 }
Example #22
0
 private void ContextMenu_ContextMenuClosing(object sender, System.Windows.Controls.ContextMenuEventArgs e)
 {
     TextureManagerMenu.Shutdown();
 }