Пример #1
0
	public static void ProcessContextMenu (object Sender, ContextMenuEventArgs e,
		WCFStandardsNS.WCFStandards DataBase,
		DoThisAfterContextProcessingEvent DoThisAfterContextProcessingCall)
		{
		Button ParentItem = Sender as Button;
		Singleton SingletonInstance = Singleton.Instance;
		SingletonInstance.m_DataBase = DataBase;
		SingletonInstance.SetDoThisAfterContextProcessingCall (DoThisAfterContextProcessingCall);
		ContextMenu FrameContextMenu = new ContextMenu ();
		ParentItem.ContextMenu = FrameContextMenu;
		MenuItem ReloadDefaultFormat = new MenuItem ();
		ReloadDefaultFormat.Header = "DefaultFormat";
		FrameContextMenu.Items.Add (ReloadDefaultFormat);
		ReloadDefaultFormat.Click += new RoutedEventHandler (ReloadDefaultFormat_Click);
		int SelectedIndex = 0;
		int LastSelectedIndex = -1;
		if (SingletonInstance.ListOfPositioningWindows != null)
			foreach (PositioningEntry PosWindow in SingletonInstance.ListOfPositioningWindows)
				{
				if (PosWindow.IsSelected == true)
					LastSelectedIndex = SelectedIndex;
				SelectedIndex++;
				}
		if ((SingletonInstance.ListOfPositioningWindows == null)
			|| (LastSelectedIndex == -1))
			{
			MenuItem NewTextBlock = new MenuItem ();
			NewTextBlock.Header = "Neuer TextBlock";
			FrameContextMenu.Items.Add (NewTextBlock);
			NewTextBlock.Click += new RoutedEventHandler (NewTextBlock_Click);
			MenuItem NewPictureBlock = new MenuItem ();
			NewPictureBlock.Header = "Neuer BildBlock";
			FrameContextMenu.Items.Add (NewPictureBlock);
			NewPictureBlock.Click += new RoutedEventHandler (NewPictureBlock_Click);
			return;
			}
		MenuItem BlockToDelete = new MenuItem ();
		BlockToDelete.Header = "Block löschen?";
		FrameContextMenu.Items.Add (BlockToDelete);
		BlockToDelete.Tag = SingletonInstance.ListOfPositioningWindows [LastSelectedIndex];
		BlockToDelete.Click += new RoutedEventHandler (BlockToDelete_Click);

		}
Пример #2
0
	public void SetDoThisAfterContextProcessingCall (DoThisAfterContextProcessingEvent DoThisAfterContextProcessingCall)
		{
		m_DoThisAfterContextProcessingCall = DoThisAfterContextProcessingCall;
		}