public void LoadContentMenu() { RadContextMenu Contextmenu = new RadContextMenu(); Contextmenu.Opened += new RoutedEventHandler(ContextMenuOpened); RadMenu menus = new RadMenu(); menus.Orientation = Orientation.Vertical; RadMenuItem menuitem1 = new RadMenuItem(); menuitem1.Header = "新建"; menuitem1.Tag = "Add"; menus.Items.Add(menuitem1); RadMenuItem menuitem2 = new RadMenuItem(); menuitem2.Header = "删除"; menuitem2.Tag = "Remove"; menus.Items.Add(menuitem2); RadMenuItem menuitem3 = new RadMenuItem(); menuitem3.Header = "禁用"; menuitem3.Tag = "Disable"; menus.Items.Add(menuitem3); Contextmenu.Items.Add(menus); RadContextMenu.SetContextMenu(RadTreeView1, Contextmenu); }
void OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e) { e.Handled = true; DependencyObject obj = e.OriginalSource as DependencyObject; var listBoxItem = GetDependencyObjectFromVisualTree(obj, typeof(ListBoxItem)) as ListBoxItem; if (listBoxItem == null) { return; } RadContextMenu menu = new RadContextMenu(); menu.ItemContainerStyleSelector = this.Resources["MenuItemStyleSelector"] as StyleSelector; var secureItemsView = listBoxItem.DataContext as ISecureItemVM; var viewModel = DataContext as SearchViewModel; if (secureItemsView != null && viewModel != null) { listBoxItem.IsSelected = true; if (viewModel.SelectedItems != null && viewModel.SelectedItems.Any()) { menu.ItemsSource = viewModel.GetActions(); } } if (menu.ItemsSource != null) { RadContextMenu.SetContextMenu(listBoxItem, menu); } }
private void ToggleTypeProxy(object sender, RadMenuEventArgs e) { RadContextMenu rcm = (RadContextMenu)sender; ImageButton imbtn_filetype = (ImageButton)rcm.Parent.FindControl(e.Item.Value); ToggleFileType(imbtn_filetype, null); }
public PropertyGridContextMenuOpeningEventArgs( PropertyGridItemBase item, RadContextMenu contextMenu) : base(item) { this.menu = contextMenu; }
private RadContextMenu ConfigurePostMenu(RadContextMenu postMenu) { var quote = new Commands.QuotePostToClipboardCommand(); var edit = new Commands.EditPostCommand(); var mark = new Commands.MarkPostAsReadCommand(); quoteMenu = new RadContextMenuItem() { Content = "quote", Command = quote }; editMenu = new RadContextMenuItem() { Content = "edit", Command = edit }; markMenu = new RadContextMenuItem() { Content = "mark as read", Command = mark }; postMenu.Items.Add(editMenu); postMenu.Items.Add(quoteMenu); postMenu.Items.Add(markMenu); postMenu.IsFadeEnabled = false; postMenu.IsZoomEnabled = false; return(postMenu); }
private void InitializeDropDownButton(RadRibbonDropDownButton dropDownButton) { var ribbonGroupContext = dropDownButton.DataContext as CreatedRibbonGroup; var ribbonItems = GetAllRibbonItems(); var contextMenu = new RadContextMenu(); foreach (var ribbonItem in ribbonItems. Where(p => p.RibbonItemMetaData.GroupGUID == ribbonGroupContext.RibbonGroupMetaData.GUID)) { if (ribbonItem.RibbonItem is IRibbonButtonItem buttonItem) { var bitMapImage = !string.IsNullOrEmpty(buttonItem.Icon) ? new BitmapImage(new Uri(buttonItem.Icon, UriKind.RelativeOrAbsolute)) : null; var image = bitMapImage != null ? new Image { Source = bitMapImage }:null; var header = LanguageService.FindResourceString(buttonItem.HeaderLanguageKey); var menuItem = new RadMenuItem { Header = header, Icon = image, Command = buttonItem.Command }; ///设定UI自动化测试相关属性; AutomationProperties.SetAutomationId(menuItem, ribbonItem.RibbonItemMetaData.GUID); AutomationProperties.SetName(menuItem, header); contextMenu.Items.Add(menuItem); } } dropDownButton.DropDownContent = contextMenu; }
public UcAttribute(Hashtable parameters) : base(parameters) { InitializeComponent(); // Init RadContextMenu menu = new RadContextMenu(); RadMenuItem itemAddNew = new RadMenuItem(); itemAddNew.Text = "Add a new Attribute"; itemAddNew.Click += new EventHandler(itemAddNew_Click); menu.Items.Add(itemAddNew); RadMenuItem itemModifica = new RadMenuItem(); itemModifica.Text = "Modify"; itemModifica.Click += new EventHandler(itemModifica_Click); menu.Items.Add(itemModifica); RadMenuItem itemDelete = new RadMenuItem(); itemDelete.Text = "Delete"; itemDelete.Click += new EventHandler(itemDelete_Click); menu.Items.Add(itemDelete); this.radPanel1.Text = FormatTitle(new List <string> { "Archive " + InputParameters["ArchiveName"].ToString(), "Attribute List" }); this.Load += new EventHandler(UcAttribute_Load); }
private void teamMembers_Click(object sender, EventArgs e) { var senderTeam = this.FindAncestor <OrgContainerShape>(); var diagramElement = this.FindAncestor <RadDiagramElement>(); if (senderTeam.IsCollapsed) { return; } if (addTeam == null) { context = new RadContextMenu(); //addTeam = new RadMenuItem() { Text = "Add Team" }; //addTeam.Click += addTeam_Click; //context.Items.Add(addTeam); //renameTeam = new RadMenuItem() { Text = "Rename Team" }; //renameTeam.Click += renameTeam_Click; //context.Items.Add(renameTeam); removeTeam = new RadMenuItem() { Text = "Remove Team" }; removeTeam.Click += removeTeam_Click; // context.Items.Add(addTeam); context.Items.Add(removeTeam); } removeTeam.Enabled = !diagramElement.Connections.Where(x => x.Source == senderTeam).Any(); context.Show(System.Windows.Forms.Control.MousePosition); }
private void GridViewKnownHands_RowLoaded(object sender, RowLoadedEventArgs e) { if (e.Row is GridViewRow row) { RadContextMenu.SetContextMenu(row, handsGridContextMenu); } }
private void TreeParameters_ContextMenuOpening(object sender, ContextMenuEventArgs e) { var contextMenu = RadContextMenu.GetContextMenu(treeParameters); if (contextMenu == null) { return; } RadTreeViewItem item = e.Source as RadTreeViewItem; if (item != null) { contextMenu.Visibility = Visibility.Visible; removeMenuItem.Visibility = Visibility.Visible; var fItem = item.DataContext as FormulaItemDTO; if (fItem.ItemType != FormuaItemType.Relationship) { insertMenuItem.Visibility = Visibility.Collapsed; } else { insertMenuItem.Visibility = Visibility.Visible; } } else { contextMenu.Visibility = Visibility.Visible; insertMenuItem.Visibility = Visibility.Visible; removeMenuItem.Visibility = Visibility.Collapsed; } }
private void GridContextMenu_ItemClick(object sender, Telerik.Windows.RadRoutedEventArgs e) { RadContextMenu menu = (RadContextMenu)sender; RadMenuItem clickedItem = e.OriginalSource as RadMenuItem; GridViewRow row = menu.GetClickedElement <GridViewRow>(); if (clickedItem != null && row != null) { string header = Convert.ToString(clickedItem.Header); switch (header) { case "Add": break; case "Edit": HSQuotationHistory lQuotation = row.Item as HSQuotationHistory; if (selectedQuotationHistoryCommand != null) { selectedQuotationHistoryCommand(lQuotation.SalesId); } break; case "Delete": break; default: break; } } }
private ReplayerHudPanel CreateHudPanel(ReplayerViewModel viewModel, int zeroBasedSeatNumber) { var player = viewModel.PlayersCollection[zeroBasedSeatNumber]; player.Parent = new HudElementViewModel { Seat = zeroBasedSeatNumber }; var panel = new ReplayerHudPanel { DataContext = player }; panel.Height = double.NaN; panel.Width = double.NaN; var playerNotes = dataService.GetPlayerNotes(player.Name, viewModel.CurrentHand.PokersiteId); player.NoteToolTip = NoteBuilder.BuildNote(playerNotes); player.Parent.IsXRayNoteVisible = playerNotes.Any(x => x.IsAutoNote); var contextMenu = CreateContextMenu(viewModel.CurrentHand.PokersiteId, player.Name, player); contextMenu.EventName = "MouseRightButtonUp"; RadContextMenu.SetContextMenu(panel, contextMenu); return(panel); }
/// <summary> /// Attaches context menu to the specified <see cref="FrameworkElement"/> /// </summary> /// <param name="hudToolViewModel"></param> /// <param name="hudTool"></param> protected virtual void AttachContextMenu(HudBaseToolViewModel hudToolViewModel, FrameworkElement hudTool) { if (hudToolViewModel == null || hudToolViewModel.Parent == null || hudTool == null) { return; } var menuItem = new RadMenuItem(); var binding = new Binding(nameof(HudElementViewModel.NoteMenuItemText)) { Source = hudToolViewModel.Parent, Mode = BindingMode.OneWay }; menuItem.SetBinding(RadMenuItem.HeaderProperty, binding); menuItem.Click += (s, e) => { var playerNoteViewModel = new PlayerNoteViewModel(hudToolViewModel.Parent.PlayerId); var playerNoteView = new PlayerNoteView(playerNoteViewModel); playerNoteView.ShowDialog(); hudToolViewModel.Parent.NoteToolTip = playerNoteViewModel.HasNotes ? playerNoteViewModel.Note : string.Empty; }; var contextMenu = new RadContextMenu(); contextMenu.Items.Add(menuItem); RadContextMenu.SetContextMenu(hudTool, contextMenu); }
private void Ex_Hold(object sender, GestureEventArgs e) { var item = (FrameworkElement)sender; RadContextMenu menu = RadContextMenu.GetContextMenu(item); menu.DataContext = item.DataContext; menu.IsOpen = true; }
public void AddMenu(Banner.ContextMenu contextMenu, RadContextMenu menu) { switch (contextMenu) { case Banner.ContextMenu.Help: break; } }
private RadContextMenu CreateImageMenu(RadContextMenu radContextMenu) { openInBrowser = new RadContextMenuItem() { Content = "open in web browser", Command = _webCommand }; radContextMenu.Items.Add(openInBrowser); return(radContextMenu); }
void OnMenuOpened(object sender, RoutedEventArgs e) { RadContextMenu menu = (RadContextMenu)sender; GridViewHeaderCell cell = menu.GetClickedElement <GridViewHeaderCell>(); if (cell != null) { menu.Items.Clear(); RadMenuItem item = new RadMenuItem(); item.Header = String.Format(@"Sort Ascending by ""{0}""", cell.Column.Header); menu.Items.Add(item); item = new RadMenuItem(); item.Header = String.Format(@"Sort Descending by ""{0}""", cell.Column.Header); menu.Items.Add(item); item = new RadMenuItem(); item.Header = String.Format(@"Clear Sorting by ""{0}""", cell.Column.Header); menu.Items.Add(item); item = new RadMenuItem(); item.Header = String.Format(@"Group by ""{0}""", cell.Column.Header); menu.Items.Add(item); item = new RadMenuItem(); item.Header = String.Format(@"Ungroup ""{0}""", cell.Column.Header); menu.Items.Add(item); item = new RadMenuItem(); item.Header = "Choose Columns:"; menu.Items.Add(item); // create menu items foreach (GridViewColumn column in grid.Columns) { RadMenuItem subMenu = new RadMenuItem(); subMenu.Header = column.Header; subMenu.IsCheckable = true; subMenu.IsChecked = true; Binding isCheckedBinding = new Binding("IsVisible"); isCheckedBinding.Mode = BindingMode.TwoWay; isCheckedBinding.Source = column; // bind IsChecked menu item property to IsVisible column property subMenu.SetBinding(RadMenuItem.IsCheckedProperty, isCheckedBinding); item.Items.Add(subMenu); } } else { menu.IsOpen = false; } }
void OnMenuItemClick(object sender, RoutedEventArgs e) { RadContextMenu menu = (RadContextMenu)sender; GridViewHeaderCell cell = menu.GetClickedElement <GridViewHeaderCell>(); RadMenuItem clickedItem = ((RadRoutedEventArgs)e).OriginalSource as RadMenuItem; GridViewColumn column = cell.Column; if (clickedItem.Parent is RadMenuItem) { return; } string header = Convert.ToString(clickedItem.Tag); using (grid.DeferRefresh()) { ColumnSortDescriptor sd = (from d in grid.SortDescriptors.OfType <ColumnSortDescriptor>() where d.Column == column select d).FirstOrDefault(); if (header.Contains("Ascending")) { if (sd != null) { grid.SortDescriptors.Remove(sd); } ColumnSortDescriptor newDescriptor = new ColumnSortDescriptor(); newDescriptor.Column = column; newDescriptor.SortDirection = ListSortDirection.Ascending; grid.SortDescriptors.Add(newDescriptor); } else if (header.Contains("Descending")) { if (sd != null) { grid.SortDescriptors.Remove(sd); } ColumnSortDescriptor newDescriptor = new ColumnSortDescriptor(); newDescriptor.Column = column; newDescriptor.SortDirection = ListSortDirection.Descending; grid.SortDescriptors.Add(newDescriptor); } else if (header.Contains("Clear")) { if (sd != null) { grid.SortDescriptors.Remove(sd); } } } }
private void Ex_Hold(object sender, GestureEventArgs e) { var item = (FrameworkElement)sender; _reorderItem = item.ParentOfType <RadDataBoundListBoxItem>(); RadContextMenu menu = RadContextMenu.GetContextMenu(item); menu.DataContext = item.DataContext; menu.IsOpen = true; }
public UcStorageArea(Hashtable parameters) : base(parameters) { InitializeComponent(); VerifyInputParameters(new List <string> { "ID", "StorageName", "IdArchive", "ArchiveName" }); // Init RadContextMenu menu = new RadContextMenu(); RadMenuItem itemAddNew = new RadMenuItem(); itemAddNew.Text = "Insert a new Storage Area"; itemAddNew.Click += new EventHandler(itemAddNew_Click); menu.Items.Add(itemAddNew); RadMenuItem itemModifica = new RadMenuItem(); itemModifica.Text = "Modify"; itemModifica.Click += new EventHandler(itemModifica_Click); menu.Items.Add(itemModifica); RadMenuItem itemStorageAreaRule = new RadMenuItem(); itemStorageAreaRule.Text = "Storage Area Rule"; itemStorageAreaRule.Click += new EventHandler(itemStorageAreaRule_Click); menu.Items.Add(itemStorageAreaRule); RadMenuItem itemDelete = new RadMenuItem(); itemDelete.Text = "Delete"; itemDelete.Visibility = ElementVisibility.Collapsed; itemDelete.Click += new EventHandler(itemDelete_Click); menu.Items.Add(itemDelete); if (InputParameters["ArchiveName"].ToString() == String.Empty) { radPanel1.Text = FormatTitle(new List <string> { "Storage " + InputParameters["StorageName"].ToString(), "StorageArea List" }); btBack.Text = "Back"; } else { radPanel1.Text = FormatTitle(new List <string> { "Archive " + InputParameters["ArchiveName"].ToString(), "Storage " + InputParameters["StorageName"].ToString(), "StorageArea List" }); btBack.Text = "Back"; } this.Load += new EventHandler(UcAttribute_Load); }
public static RadContextMenu GenerateContextMenu(RadGridView gridView) { var contextMenu = new RadContextMenu(); RadMenuItem insertMenuItem = new RadMenuItem(); insertMenuItem.Header = "افزودن"; insertMenuItem.Click += (sender, e) => InsertMenuItem_Click(sender, e, gridView); contextMenu.Items.Add(insertMenuItem); RadContextMenu.SetContextMenu(gridView, contextMenu); return(contextMenu); }
private RadContextMenu GetParameterContextMenu(ItemCollection collection, int entityID, int parameterID) { RadContextMenu menu = new RadContextMenu(); RadMenuItem item = new RadMenuItem(); item.Header = "اصلاح پارامتر"; item.Click += (sender, e) => item_Click(sender, e, collection, entityID, parameterID); menu.Items.Add(item); return(menu); }
private RadContextMenu GetCodeFunctionContextMenu(ItemCollection collection, int entityID, int codeFunctionEntityID) { RadContextMenu menu = new RadContextMenu(); RadMenuItem item = new RadMenuItem(); item.Header = "اصلاح فانکشن"; item.Click += (sender, e) => item_ClickCodeFunctionEdit(sender, e, collection, entityID, codeFunctionEntityID); menu.Items.Add(item); return(menu); }
private RadContextMenu GetParametersContextMenu(int entityID, RadTreeViewItem parametersNode) { RadContextMenu menu = new RadContextMenu(); RadMenuItem item = new RadMenuItem(); item.Header = "تعریف پارامتر"; item.Click += (sender, e) => item_Click(sender, e, entityID, parametersNode); menu.Items.Add(item); return(menu); }
private void Chart_ContextMenuOpening(object sender, ChartViewContextMenuOpeningEventArgs e) { try { RadContextMenu Menu = new RadContextMenu(); RadMenuItem MenuItem = new RadMenuItem("Exportar Gráfica"); MenuItem.Click += new EventHandler(MenuItem_Click); Menu.Items.Add(MenuItem); e.ContextMenu = Menu; } catch (Exception ex) { RadMessageBox.Show("Ocurrio un error al mostrar el menú\n" + ex.Message, this.Text, MessageBoxButtons.OK, RadMessageIcon.Error); } }
private RadTreeViewItem AddParameterNode(ItemCollection collection, FormulaDTO formula) { var node = GetNode(); node.DataContext = formula; node.Header = GetNodeHeader(formula.Name, DatabaseObjectCategory.Formula); node.ToolTip = formula.Title; collection.Add(node); _AllItems.Add(node); RadContextMenu.SetContextMenu(node, GetParameterContextMenu(collection, formula.EntityID, formula.ID)); return(node); }
private RadTreeViewItem AddCodeFunctionNode(ItemCollection collection, CodeFunction_EntityDTO codeFunctionEntity) { var node = GetNode(); node.DataContext = codeFunctionEntity; node.Header = GetNodeHeader(codeFunctionEntity.CodeFunction.ClassName, DatabaseObjectCategory.CodeFunction); node.ToolTip = codeFunctionEntity.CodeFunction.ClassName; collection.Add(node); _AllItems.Add(node); RadContextMenu.SetContextMenu(node, GetCodeFunctionContextMenu(collection, codeFunctionEntity.EntityID, codeFunctionEntity.ID)); return(node); }
internal void Attach() { if (this._grid == null) return; var contextMenu = new RadContextMenu(); StyleManager.SetTheme(contextMenu, StyleManager.GetTheme(this._grid)); contextMenu.Opened += this.OnMenuOpened; contextMenu.ItemClick += this.OnMenuItemClick; RadContextMenu.SetContextMenu(this._grid, contextMenu); }
protected void borrarCondiciones() { if (FileExplorerObrasParticulares.Visible == true) { RadToolBar toolBar = FileExplorerObrasParticulares.ToolBar; int i = 0; while (i < toolBar.Items.Count) { if (toolBar.Items[i].Value == "Delete") { toolBar.Items.RemoveAt(i); continue; } else if (toolBar.Items[i].Value == "Upload") { toolBar.Items.RemoveAt(i); continue; } else if (toolBar.Items[i].Value == "Rename") { toolBar.Items.RemoveAt(i); continue; } i++; } RadContextMenu gridContextMenu = FileExplorerObrasParticulares.GridContextMenu; i = 0; while (i < gridContextMenu.Items.Count) { if (gridContextMenu.Items[i].Value == "Delete") { gridContextMenu.Items.RemoveAt(i); continue; } else if (gridContextMenu.Items[i].Value == "Upload") { gridContextMenu.Items.RemoveAt(i); continue; } else if (gridContextMenu.Items[i].Value == "Rename") { gridContextMenu.Items.RemoveAt(i); continue; } i++; } } }
public static RadTreeNode Build(Solution sol, RadContextMenu radContextMenu1) { var ret = new RadTreeNode($"Solution '{sol.Name}'", true); ret.Tag = sol; foreach (var p in sol.Projects) { var pn = Build(p, radContextMenu1); ret.Nodes.Add(pn); } return ret; }
private void Attach() { if (grid != null) { RadContextMenu contextMenu = new RadContextMenu(); StyleManager.SetTheme(contextMenu, StyleManager.GetTheme(grid)); contextMenu.Opened += OnMenuOpened; contextMenu.ItemClick += OnMenuItemClick; RadContextMenu.SetContextMenu(grid, contextMenu); } }
private void GridViewReport_RowLoaded(object sender, RowLoadedEventArgs e) { if (e.Row is GridViewRow row) { if (reportGadgetViewModel.ReportSelectedItemStat == EnumReports.Tournaments) { RadContextMenu.SetContextMenu(row, tournamentsGridContextMenu); } else { RadContextMenu.SetContextMenu(row, reportsGridContextMenu); } } }
public static void SetContectMenuVisibility(RadContextMenu contextMenu) { bool menuExists = false; foreach (var item in contextMenu.Items) { if (!(item is RadMenuSeparatorItem)) { menuExists = true; break; } } contextMenu.Visibility = (menuExists ? Visibility.Visible : Visibility.Collapsed); }
public void AddMenu(Banner.ContextMenu contextMenu, RadContextMenu menu) { switch (contextMenu) { case Banner.ContextMenu.Actions: menu.ClientIDMode = ClientIDMode.Static; menu.ID = "RadContextMenuActions"; menu.Skin = "Office2010Silver"; menu.EnableRoundedCorners = true; menu.EnableShadows = true; PlaceHolderActions.Controls.Add(menu); break; } }
/// <summary> /// Attaches this instance. /// </summary> internal void Attach() { var grid = _grid; if (grid == null) { return; } var contextMenu = new RadContextMenu(); StyleManager.SetTheme(contextMenu, StyleManager.GetTheme(grid)); contextMenu.Opened += OnMenuOpened; contextMenu.ItemClick += OnMenuItemClick; RadContextMenu.SetContextMenu(grid, contextMenu); }
public static RadTreeNode Build(Project proj, RadContextMenu radContextMenu1) { var pn = new RadTreeNode($"Project '{proj.Name}'", true); pn.Tag = proj; pn.ContextMenu = radContextMenu1; var props = new RadTreeNode("Properties", Resources.Property, true); props.Tag = new PropertiesView(); pn.Nodes.Add(props); pn.Expanded = proj.Expandet; foreach (var f in proj.Files) { var n = Build(f); pn.Nodes.Add(n); } return pn; }
private void versionsListView_ItemMouseClick(object sender, ListViewItemEventArgs e) { versionsListView.SelectedItem = e.Item; Version ver = Version.ParseVersion(new DirectoryInfo(Path.Combine(_applicationContext.McVersions, versionsListView.SelectedItem[0].ToString() + "\\")), false); RadMenuItem launchVerButton = new RadMenuItem { Text = _applicationContext.ProgramLocalization.Launch }; launchVerButton.Click += delegate { if (versionsListView.SelectedItem == null) { return; } _versionToLaunch = versionsListView.SelectedItem[0].ToString(); LaunchButton.PerformClick(); }; bool enableRestoreButton = false; switch (ver.ReleaseType) { case "release": case "snapshot": case "old_beta": case "old_alpha": enableRestoreButton = true; break; } RadMenuItem restoreVerButton = new RadMenuItem { Text = "Restore and launch", Enabled = enableRestoreButton }; restoreVerButton.Click += delegate { _restoreVersion = true; _versionToLaunch = versionsListView.SelectedItem[0].ToString(); LaunchButton.PerformClick(); }; RadMenuItem openVerButton = new RadMenuItem { Text = _applicationContext.ProgramLocalization.OpenLocation }; openVerButton.Click += delegate { if (versionsListView.SelectedItem == null) { return; } Process.Start(Path.Combine(_applicationContext.McVersions, versionsListView.SelectedItem[0].ToString() + "\\")); }; RadMenuItem delVerButton = new RadMenuItem { Text = _applicationContext.ProgramLocalization.DeleteVersion}; delVerButton.Click += delegate { if (versionsListView.SelectedItem == null) { return; } DialogResult dr = RadMessageBox.Show( string.Format(_applicationContext.ProgramLocalization.DeleteConfirmationText, versionsListView.SelectedItem[0].ToString()), _applicationContext.ProgramLocalization.DeleteConfirmationTitle, MessageBoxButtons.YesNo, RadMessageIcon.Question); if (dr != DialogResult.Yes) { return; } try { Directory.Delete( Path.Combine(_applicationContext.McVersions, versionsListView.SelectedItem[0].ToString() + "\\"), true); AppendLog($"Version '{versionsListView.SelectedItem[0].ToString()}' has been deleted successfuly."); UpdateVersionListView(); } catch (Exception ex) { AppendException($"An error has occurred during version deletion: {ex.ToString()}"); } string path = Path.Combine(_applicationContext.McVersions, _selectedProfile.SelectedVersion ?? GetLatestVersion(_selectedProfile) + "\\"); string state = _applicationContext.ProgramLocalization.ReadyToLaunch; if (!File.Exists(string.Format("{0}/{1}.json", path, _selectedProfile.SelectedVersion ?? GetLatestVersion(_selectedProfile)))) { state = _applicationContext.ProgramLocalization.ReadyToDownload; } SelectedVersion.Text = string.Format(state, (_selectedProfile.SelectedVersion ?? GetLatestVersion(_selectedProfile))); }; RadContextMenu verListMenuStrip = new RadContextMenu(); verListMenuStrip.Items.Add(launchVerButton); verListMenuStrip.Items.Add(new RadMenuSeparatorItem()); verListMenuStrip.Items.Add(restoreVerButton); verListMenuStrip.Items.Add(new RadMenuSeparatorItem()); verListMenuStrip.Items.Add(openVerButton); verListMenuStrip.Items.Add(delVerButton); new RadContextMenuManager().SetRadContextMenu(versionsListView, verListMenuStrip); }
private RadContextMenu CreateImageMenu(RadContextMenu radContextMenu) { openInBrowser = new RadContextMenuItem() { Content = "open in web browser", Command = _webCommand }; radContextMenu.Items.Add(openInBrowser); return radContextMenu; }
private void OnMouseRightButtonDown(object sender, MouseButtonEventArgs mouseButtonEventArgs) { var menu = new RadContextMenu(); var exportItem = new RadMenuItem {Header = "Выгрузить в Excel"}; exportItem.Click += (s, e) => ExportToExcel(); menu.Items.Add(exportItem); menu.HorizontalOffset = System.Windows.Forms.Cursor.Position.X; menu.VerticalOffset = System.Windows.Forms.Cursor.Position.Y; menu.IsOpen = true; mouseButtonEventArgs.Handled = true; }
/// <summary> /// 初始化RadWindow控件的Content的值 /// </summary> /// <param name="windowsType">窗体的类型,主要有三个:1、运行历史 2、商业数据 3、申请</param> /// <param name="obj">RadGridView控件的数据集合</param> /// <returns></returns> public Grid CreateRadWindows(string windowsType, object obj) { Grid grid = new Grid(); RadGridView gridview; if (windowsType == "运营历史") { gridview = new RadGridView(); gridview.ShowGroupPanel = true; gridview.AutoGenerateColumns = false; gridview.IsReadOnly = true; gridview.IsFilteringAllowed = true; gridview.RowIndicatorVisibility = Visibility.Collapsed; var OperationHistories = new List<OperationHistory>(); OperationHistories.Add((obj as OperationPlan).OperationHistory); gridview.ItemsSource = OperationHistories; var gv1 = new GridViewDataColumn { Header = "航空公司", DataMemberBinding = new System.Windows.Data.Binding("Airlines.ShortName") }; var gv2 = new GridViewDataColumn { Header = "飞机号", DataMemberBinding = new System.Windows.Data.Binding("Aircraft.RegNumber") }; var gv3 = new GridViewDataColumn { Header = "机型", DataMemberBinding = new System.Windows.Data.Binding("Aircraft.AircraftType.Name") }; var gv4 = new GridViewDataColumn { Header = "技术接收日期" }; var bing4 = new System.Windows.Data.Binding("TechReceiptDate") { StringFormat = "yyyy/M/d" }; gv4.DataMemberBinding = bing4; var gv5 = new GridViewDataColumn { Header = "接收日期" }; var bing5 = new System.Windows.Data.Binding("ReceiptDate") { StringFormat = "yyyy/M/d" }; gv5.DataMemberBinding = bing5; var gv6 = new GridViewDataColumn { Header = "运营日期" }; var bing6 = new System.Windows.Data.Binding("StartDate") { StringFormat = "yyyy/M/d" }; gv6.DataMemberBinding = bing6; var gv7 = new GridViewDataColumn { Header = "退出停场日期" }; var bing7 = new System.Windows.Data.Binding("StopDate") { StringFormat = "yyyy/M/d" }; gv7.DataMemberBinding = bing7; var gv8 = new GridViewDataColumn { Header = "技术交付日期" }; var bing8 = new System.Windows.Data.Binding("TechDeliveryDate") { StringFormat = "yyyy/M/d" }; gv8.DataMemberBinding = bing8; var gv9 = new GridViewDataColumn { Header = "退出日期" }; var bing9 = new System.Windows.Data.Binding("EndDate") { StringFormat = "yyyy/M/d" }; gv9.DataMemberBinding = bing9; var gv10 = new GridViewDataColumn { Header = "起租日期" }; var bing10 = new System.Windows.Data.Binding("OnHireDate") { StringFormat = "yyyy/M/d" }; gv10.DataMemberBinding = bing10; var gv11 = new GridViewDataColumn { Header = "引进方式", DataMemberBinding = new System.Windows.Data.Binding("ImportCategory.ActionName") }; var gv12 = new GridViewDataColumn { Header = "退出方式", DataMemberBinding = new System.Windows.Data.Binding("ExportCategory.ActionName") }; var gv13 = new GridViewDataColumn { Header = "备注", DataMemberBinding = new System.Windows.Data.Binding("Note") }; SerialColumn gv14 = new SerialColumn(); ResourceDictionary dictionary = new ResourceDictionary(); dictionary.Source = new Uri("/UniCloud.Infrastructure;component/Resources/CafmStyle.xaml", UriKind.Relative); gv14.Header = "序号"; gv14.CellStyle = (Style)dictionary["style"]; gridview.Columns.Add(gv14); gridview.Columns.Add(gv1); gridview.Columns.Add(gv2); gridview.Columns.Add(gv3); gridview.Columns.Add(gv4); gridview.Columns.Add(gv5); gridview.Columns.Add(gv6); gridview.Columns.Add(gv7); gridview.Columns.Add(gv8); gridview.Columns.Add(gv9); gridview.Columns.Add(gv10); gridview.Columns.Add(gv11); gridview.Columns.Add(gv12); gridview.Columns.Add(gv13); } else if (windowsType == "商业数据") { gridview = new RadGridView(); gridview.ShowGroupPanel = true; gridview.AutoGenerateColumns = false; gridview.IsReadOnly = true; gridview.IsFilteringAllowed = true; gridview.RowIndicatorVisibility = Visibility.Collapsed; List<AircraftBusiness> aircraftBusiness = new List<AircraftBusiness>(); aircraftBusiness.Add((obj as ChangePlan).AircraftBusiness); gridview.ItemsSource = aircraftBusiness; GridViewDataColumn gv1 = new GridViewDataColumn(); gv1.Header = "商业数据开始"; System.Windows.Data.Binding bing1 = new System.Windows.Data.Binding("StartDate"); bing1.StringFormat = "yyyy/M/d"; gv1.DataMemberBinding = bing1; GridViewDataColumn gv2 = new GridViewDataColumn(); gv2.Header = "商业数据结束"; System.Windows.Data.Binding bing2 = new System.Windows.Data.Binding("StartDate"); bing2.StringFormat = "yyyy/M/d"; gv2.DataMemberBinding = bing2; GridViewDataColumn gv3 = new GridViewDataColumn(); gv3.Header = "航空公司"; gv3.DataMemberBinding = new System.Windows.Data.Binding("Airlines.ShortName"); GridViewDataColumn gv4 = new GridViewDataColumn(); gv4.Header = "飞机号"; gv4.DataMemberBinding = new System.Windows.Data.Binding("Aircraft.RegNumber"); GridViewDataColumn gv5 = new GridViewDataColumn(); gv5.Header = "机型"; gv5.DataMemberBinding = new System.Windows.Data.Binding("Aircraft.AircraftType.Name"); GridViewDataColumn gv6 = new GridViewDataColumn(); gv6.Header = "座位数"; gv6.DataMemberBinding = new System.Windows.Data.Binding("SeatingCapacity"); GridViewDataColumn gv7 = new GridViewDataColumn(); gv7.Header = "商载(吨)"; gv7.DataMemberBinding = new System.Windows.Data.Binding("CarryingCapacity"); SerialColumn gv8 = new SerialColumn(); ResourceDictionary dictionary = new ResourceDictionary(); dictionary.Source = new Uri("/UniCloud.Infrastructure;component/Resources/CafmStyle.xaml", UriKind.Relative); gv8.Header = "序号"; gv8.CellStyle = (Style)dictionary["style"]; gridview.Columns.Add(gv8); gridview.Columns.Add(gv1); gridview.Columns.Add(gv2); gridview.Columns.Add(gv3); gridview.Columns.Add(gv4); gridview.Columns.Add(gv5); gridview.Columns.Add(gv6); gridview.Columns.Add(gv7); } else //申请 { gridview = new RadGridView(); gridview.ShowGroupPanel = true; gridview.AutoGenerateColumns = false; gridview.IsReadOnly = true; gridview.IsFilteringAllowed = true; gridview.RowIndicatorVisibility = Visibility.Collapsed; List<ApprovalHistory> approvalHistories = new List<ApprovalHistory>(); approvalHistories.Add((obj as PlanHistory).ApprovalHistory); gridview.ItemsSource = approvalHistories; GridViewDataColumn gv1 = new GridViewDataColumn(); gv1.Header = "座级"; System.Windows.Data.Binding bing1 = new System.Windows.Data.Binding("PlanAircraft.AircraftType.AircraftCategory.Regional"); gv1.DataMemberBinding = bing1; GridViewDataColumn gv2 = new GridViewDataColumn(); gv2.Header = "机型"; System.Windows.Data.Binding bing2 = new System.Windows.Data.Binding("PlanAircraft.AircraftType.Name"); gv2.DataMemberBinding = bing2; GridViewDataColumn gv3 = new GridViewDataColumn(); gv3.Header = "引进方式"; gv3.DataMemberBinding = new System.Windows.Data.Binding("ImportCategory.ActionName"); GridViewDataColumn gv4 = new GridViewDataColumn(); gv4.Header = "座位数"; gv4.DataMemberBinding = new System.Windows.Data.Binding("SeatingCapacity"); GridViewDataColumn gv5 = new GridViewDataColumn(); gv5.Header = "商载(吨)"; gv5.DataMemberBinding = new System.Windows.Data.Binding("CarryingCapacity"); GridViewDataColumn gv6 = new GridViewDataColumn(); gv6.Header = "申请交付时间"; gv6.UniqueName = "performTime"; gv6.DataMemberBinding = new System.Windows.Data.Binding("RequestDeliver"); SerialColumn gv7 = new SerialColumn(); ResourceDictionary dictionary = new ResourceDictionary(); dictionary.Source = new Uri("/UniCloud.Infrastructure;component/Resources/CafmStyle.xaml", UriKind.Relative); gv7.Header = "序号"; gv7.CellStyle = (Style)dictionary["style"]; gridview.Columns.Add(gv7); gridview.Columns.Add(gv1); gridview.Columns.Add(gv2); gridview.Columns.Add(gv3); gridview.Columns.Add(gv4); gridview.Columns.Add(gv5); gridview.Columns.Add(gv6); } if (gridview != null) { var radContext = new RadContextMenu(); radContext.ItemClick += radContext_ItemClick; var radMenuItem = new RadMenuItem { Header = "导出数据", }; radContext.Items.Add(radMenuItem); RadContextMenu.SetContextMenu(gridview, radContext); //为控件绑定右键菜单 } grid.Children.Add(gridview); return grid; }
/// <summary> /// Add a new selected value /// </summary> private void AddValueButton(string text) { //Create an item button Button button = new Button(); button.Style = ValueButtonStyle; button.Content = text; RadContextMenu menu = new RadContextMenu(); menu.IsZoomEnabled = false; RadContextMenu.SetContextMenu(button, menu); RadContextMenuItem miRemove = new RadContextMenuItem() { Content = "Remove" }; menu.Items.Add(miRemove); RadContextMenuItem miEdit = new RadContextMenuItem() { Content = "Edit" }; menu.Items.Add(miEdit); menu.ItemTapped += (s, e) => { if (e.VisualContainer == miEdit) { textBox.Text = (string)button.Content; textBox.Focus(); } wrapPanel.Children.Remove(button); }; button.Tap += (s, e) => { menu.IsOpen = true; e.Handled = true; }; //Insert before the TextBox wrapPanel.Children.Insert(wrapPanel.Children.Count - 1, button); }
public void SetUpContextMenus(CommonUtils.FavouriteType favouriteType, RadContextMenu radContextMenu) { mfavouriteType = favouriteType; if (favouriteType == CommonUtils.FavouriteType.DocumentRole || favouriteType == CommonUtils.FavouriteType.Document) { if (radContextMenu == null) { return; } radContextMenu.Opened += (s, e) => { RadContextMenu menu = (RadContextMenu)s; menu.Items.Clear(); GridViewRow row = menu.GetClickedElement<GridViewRow>(); if (row != null) { row.IsSelected = row.IsCurrent = true; GridViewCell cell = menu.GetClickedElement<GridViewCell>(); if (cell != null) { cell.IsCurrent = true; var quickDocument = row.DataContext as LightDocument; if (quickDocument != null) { string header = "Remove from My Favourites"; if (favouriteType == CommonUtils.FavouriteType.DocumentRole) { header = "Remove from Frequently Used in My Role"; } RadMenuItem rmi = new RadMenuItem { Header = header, Icon = null }; if (favouriteType == CommonUtils.FavouriteType.DocumentRole) { rmi.IsEnabled = (quickDocument.IsActive); } else { rmi.IsEnabled = (CMS.EffectivePrivileges.AdminTab.CanModify || CMS.EffectivePrivileges.DocumentTab.CanView) && quickDocument.IsActive; } rmi.Click += (s3, args) => RemoveFromFavourites(quickDocument); menu.Items.Add(rmi); string header2 = "Remove ALL from My Favourites"; if (favouriteType == CommonUtils.FavouriteType.DocumentRole) { header2 = "Remove ALL from Frequently Used in My Role"; } rmi = new RadMenuItem { Header = header2, Icon = null }; int k1 = (from x in Documents where x.IsActive select x.Id).Count(); rmi.IsEnabled = (k1 > 0); rmi.Click += (s4, args) => RemovedFilteredFromMyFavourites(); menu.Items.Add(rmi); } } } else { menu.IsOpen = false; } }; } else { if (radContextMenu != null) { radContextMenu.Visibility = Visibility.Collapsed; } } }
public void AddRadMenu(RadWindow rwindow) { RadContextMenu radcm = new RadContextMenu();//新建右键菜单 radcm.Opened += radcm_Opened; RadMenuItem rmi = new RadMenuItem();//新建右键菜单项 rmi.Header = "导出表格"; rmi.Click += new RadRoutedEventHandler(MenuItem_Click);//为菜单项注册事件 rmi.DataContext = rwindow.Name; radcm.Items.Add(rmi); RadContextMenu.SetContextMenu(rwindow, radcm);//为控件绑定右键菜单 }
public void AddRadMenu(RadWindow rwindow) { var radcm = new RadContextMenu(); //新建右键菜单 radcm.Opened += radcm_Opened; var rmi = new RadMenuItem {Header = "导出表格"}; //新建右键菜单项 rmi.Click += MenuItemClick; //为菜单项注册事件 rmi.DataContext = rwindow.Name; radcm.Items.Add(rmi); RadContextMenu.SetContextMenu(rwindow, radcm); //为控件绑定右键菜单 }
private void _contextMenu_Opened(object sender, EventArgs e) { _tempContextMenu = sender as RadContextMenu; }
private RadContextMenu CreateLinkMenu(RadContextMenu radContextMenu) { var saCommand = new Commands.ViewSAThreadCommand(); var webCommand = _webCommand; viewOnSA = new RadContextMenuItem() { Content = "open in Awful!", Command = saCommand }; viewOnWeb = new RadContextMenuItem() { Content = "open in web browser", Command = webCommand }; radContextMenu.Items.Add(viewOnSA); radContextMenu.Items.Add(viewOnWeb); return radContextMenu; }
private RadContextMenu TinyMenu(TinhTrang_PhongInfo item) { RadContextMenu retContextMenu = new RadContextMenu(); retContextMenu.Cursor = Cursors.Hand; retContextMenu.EventName = "MouseLeftButtonUp"; retContextMenu.IconColumnWidth = 0; StyleManager.SetTheme(retContextMenu, new Office_BlueTheme()); RadMenuItem menuItem = null; menuItem = new RadMenuItem(); menuItem.Tag = "ThongTinPhong"; menuItem.CommandParameter = item; menuItem.Header = "Thông tin phòng"; menuItem.Click += new Telerik.Windows.RadRoutedEventHandler(menuItem_Click); retContextMenu.Items.Add(menuItem); return retContextMenu; }
private RadContextMenu ConfigurePostMenu(RadContextMenu postMenu) { var quote = new Commands.QuotePostToClipboardCommand(); var edit = new Commands.EditPostCommand(); var mark = new Commands.MarkPostAsReadCommand(); quoteMenu = new RadContextMenuItem() { Content = "quote", Command = quote }; editMenu = new RadContextMenuItem() { Content = "edit", Command = edit }; markMenu = new RadContextMenuItem() { Content = "mark as read", Command = mark }; postMenu.Items.Add(editMenu); postMenu.Items.Add(quoteMenu); postMenu.Items.Add(markMenu); postMenu.IsFadeEnabled = false; postMenu.IsZoomEnabled = false; return postMenu; }
private RadContextMenu FullMenu( TinhTrang_PhongInfo item ) { RadContextMenu retContextMenu = new RadContextMenu(); retContextMenu.Cursor = Cursors.Hand; retContextMenu.EventName = "MouseLeftButtonUp"; retContextMenu.IconColumnWidth = 0; StyleManager.SetTheme(retContextMenu, new Office_BlueTheme()); RadMenuItem menuItem = null; menuItem = new RadMenuItem(); menuItem.Header = "Thông tin phòng"; menuItem.Tag = "ThongTinPhong"; menuItem.CommandParameter = item; menuItem.Click += new Telerik.Windows.RadRoutedEventHandler(menuItem_Click); retContextMenu.Items.Add(menuItem); menuItem = new RadMenuItem(); menuItem.Header = "Danh sách khách hàng"; menuItem.Tag = "DanhSachKhachHang"; menuItem.CommandParameter = item; menuItem.Click += new Telerik.Windows.RadRoutedEventHandler(menuItem_Click); retContextMenu.Items.Add(menuItem); menuItem = new RadMenuItem(); menuItem.Header = "Danh sách đặt phòng"; menuItem.Tag = "DanhSachDatPhong"; menuItem.Visibility = System.Windows.Visibility.Collapsed; menuItem.CommandParameter = item; menuItem.Click += new Telerik.Windows.RadRoutedEventHandler(menuItem_Click); retContextMenu.Items.Add(menuItem); menuItem = new RadMenuItem(); menuItem.Tag = "XemThemDichVu"; menuItem.CommandParameter = item; menuItem.Header = "Xem/Thêm dịch vụ"; menuItem.Click += new Telerik.Windows.RadRoutedEventHandler(menuItem_Click); retContextMenu.Items.Add(menuItem); menuItem = new RadMenuItem(); menuItem.Tag = "ChuyenPhong"; menuItem.CommandParameter = item; menuItem.Header = "Chuyển phòng"; menuItem.Click += new Telerik.Windows.RadRoutedEventHandler(menuItem_Click); retContextMenu.Items.Add(menuItem); menuItem = new RadMenuItem(); menuItem.Tag = "CapNhatNgayRaDuTinh"; menuItem.CommandParameter = item ; menuItem.Header = "Cập nhật ngày ra dự tính"; menuItem.Click += new Telerik.Windows.RadRoutedEventHandler(menuItem_Click); retContextMenu.Items.Add(menuItem); menuItem = new RadMenuItem(); menuItem.Tag = "TraPhong"; menuItem.CommandParameter = item; menuItem.Header = "Trả phòng"; menuItem.Click += new Telerik.Windows.RadRoutedEventHandler(menuItem_Click); retContextMenu.Items.Add(menuItem); return retContextMenu; }