Пример #1
0
		//-------------------------------------------------------------------------------------
		private void contextMenuStripView_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
		{
			try
			{
				if(ftgvView.CurrentRow == null)
					return;
				ViewItem vi = (ViewItem)ftgvView.CurrentRow.GetData();
				switch(e.ClickedItem.Name)
				{
					case "menuItemShowNonPublic":
					{
						showNonPublic = !showNonPublic;
						ITree tree = new Tree<ViewItem>() ;
						foreach(ITreeItem i in ftgvView.Tree.GetRootItems())
							tree.Add(i.Object, null);
						ftgvView.Tree = tree;
						ftgvView.Expand((ITreeItem)tree.GetRootItems().First());
					} break;
						case "menuItemShowIEnumProps" : 
					{
						showIEnumProps = !showIEnumProps;
						ITree tree = new Tree<ViewItem>();
						foreach(ITreeItem i in ftgvView.Tree.GetRootItems())
							tree.Add(i.Object, null);
						ftgvView.Tree = tree;
						ftgvView.Expand((ITreeItem)tree.GetRootItems().First());
					} break;
				case "menuItemCopyName" :
						Clipboard.SetText(vi.Name);
						break;
					case "menuItemCopyValue" :
						Clipboard.SetText(vi.Value.ToString());
						break;
					case "menuItemCopyType" :
						Clipboard.SetText(vi.Type.ToString());
						break;
					case "menuItemToStore" : 
					{
						e.ClickedItem.Owner.Hide();
						string s = vi.Name;
						while(true)
						{
							if(SimModalInputBox.Show(PanelBack,ref s, "Добавление объекта", "Введите имя объекта:",
												global::Sim.AdminForms.Properties.Resources.Object_Add) == System.Windows.Forms.DialogResult.Cancel)
								return;
							if(store.ContainsKey(s))
								SimModalMessageBox.Show(PanelBack, "Объект с таким именем уже существует!", "Ошибка имени объекта",
									MessageBoxIcon.Error);
							else
								break;
						}
						store.Add(s, new StoreItem(s, vi.Value)); 

					} break;
					case "menuItemObjectRefresh" :
					{
						ITreeItem item = (ITreeItem)ftgvView.Tree.Items.First();
						ViewItem v = (ViewItem)item.Object;
						FillAnswer(v.obj ?? v.parObj, v.Name);
					} break;
				}
			}
			catch(Exception Err)
			{
				ModalErrorBox.Show(Err, PanelBack);
			}
		}