示例#1
0
    public VisualPipes(string EditingFileName)
    {
        Debug.WriteLine(
            "Starting Visual-Pipes, the visual real-time pipe composer");

        OpenFilename = EditingFileName;

        addButton            = new CheckBox();
        addButton.Text       = "Add node";
        addButton.Click     += AddButtonClick;
        addButton.Appearance = System.Windows.Forms.Appearance.Button;

        Controls.Add(addButton);

        CMenu = new ContextMenuView();
        CMenu.AddSlice(MenuSlice.Cancel, "Cancel");
        CMenu.AddSlice(MenuSlice.Properties, "Edit");
        CMenu.AddSlice(MenuSlice.ViewStdout, "stdout");
        CMenu.AddSlice(MenuSlice.ViewStdin, "stdin");
        CMenu.AddSlice(MenuSlice.ViewStderr, "stderr");
        CMenu.AddSlice(MenuSlice.Delete, "Delete");
        CMenu.AddSlice(MenuSlice.Start, "Run");

        CMenu.OnSelect += OnMenuSelect;

        Size          = new Size(640, 480);
        StartPosition = FormStartPosition.CenterScreen;
        MouseDown    += WindowMouseDown;
        MouseUp      += WindowMouseUp;
        MouseMove    += WindowMouseMove;


        if (OpenFilename.Length > 0)
        {
            Text = "Visual Pipes <" + OpenFilename + ">";
            Deserialize();
        }
        else
        {
            Text = "Visual Pipes";
        }
    }
示例#2
0
    private void OnMenuSelect(ContextMenuView c, ContextMenuEvent e)
    {
        switch (e.SelectedSlice.Type)
        {
        case MenuSlice.Cancel: {
            // Do nothing
            break;
        }

        case MenuSlice.Delete: {
            // Deleting a node.
            Debug.Assert(SelectedNode != null);
            DeleteNode(SelectedNode);
            SelectedNode = null;
            UpdateView();
            break;
        }

        case MenuSlice.Properties:
        {
            Debug.Assert(SelectedNode != null);
            Text = "Visual Pipes <Command>";

            s = EditorState.EditProperties;

            NodePropertiesForm props =
                new NodePropertiesForm(SelectedNode.Model);
            props.FormClosed += PropertiesClosed;
            props.ShowDialog(this);

            break;
        }

        case MenuSlice.Start:
        {
            Debug.Assert(SelectedNode != null);
            runner.Start(SelectedNode.Model, nodems);
            break;
        }
        }
    }
示例#3
0
 private void ctmView(object sender, RoutedEventArgs e)
 {
     DataContext = new ContextMenuView(grdEmployee);
 }
示例#4
0
        //double timeToLive,
        public async static void Show(
            string message,
            string title,
            ContextMenuType type,
            double width  = 400,
            double height = 180,
            GeneralSystemWideMessage msgToPassAlong = null
            )
        {
            if (ContextMenuService._rootControl != null)
            {
                DispatchedHandler invokedHandler = new DispatchedHandler(() =>
                {
                    if (ContextMenuService._rootControl == null)
                    {
                        return;
                    }


                    //modal adorner
                    Rectangle rectModalAdorner           = new Rectangle();
                    rectModalAdorner.Fill                = new SolidColorBrush(Colors.Black);
                    rectModalAdorner.Opacity             = 0.4;
                    rectModalAdorner.HorizontalAlignment = HorizontalAlignment.Stretch;
                    rectModalAdorner.VerticalAlignment   = VerticalAlignment.Stretch;
                    rectModalAdorner.SetValue(Canvas.ZIndexProperty, -2);
                    ContextMenuService._rootControl.Children.Add(rectModalAdorner);


                    //message background
                    Rectangle rectBackground           = new Rectangle();
                    rectBackground.HorizontalAlignment = HorizontalAlignment.Stretch;
                    rectBackground.VerticalAlignment   = VerticalAlignment.Center;
                    rectBackground.Height = height + 80;
                    rectBackground.SetValue(Canvas.ZIndexProperty, -1);
                    rectBackground.SetBinding(Rectangle.FillProperty, new Windows.UI.Xaml.Data.Binding()
                    {
                        Path = new PropertyPath("UI.Theme.AccentBackground1")
                    });
                    ContextMenuService._rootControl.Children.Add(rectBackground);

                    ContextMenuService._rootControl.Visibility = Visibility.Visible;

                    //message
                    ContextMenuView view = new ContextMenuView(
                        message,
                        "",
                        msgToPassAlong: msgToPassAlong
                        );

                    view.Width  = width;
                    view.Height = height;
                    view.Margin = new Thickness(3);
                    view.HorizontalAlignment = HorizontalAlignment.Center;
                    view.VerticalAlignment   = VerticalAlignment.Center;

                    if (type == ContextMenuType.PhotoDetailFlickrUserPicture)
                    {
                        //view.LoadMainContent(new PhotoDetailFlickrUserPictureContextMenu());
                    }
                    else if (type == ContextMenuType.PhotoDetailFlickrCommentUserPicture)
                    {
                        //view.LoadMainContent(new PhotoDetailFlickrCommentUserPictureContextMenu() { MessageToPassAlong = msgToPassAlong });
                    }
                    else if (type == ContextMenuType.TreePublicFlickrUser)
                    {
                        //view.LoadMainContent(new PublicFlickrUserPictureContextMenu() { MessageToPassAlong = msgToPassAlong });
                    }
                    else if (type == ContextMenuType.SectionHeaderFlickrUser)
                    {
                        //view.LoadMainContent(new SectionHeaderPictureContextMenu() { MessageToPassAlong = msgToPassAlong });
                    }

                    view.Show();
                    ContextMenuService._rootControl.Children.Add(view);
                });

                await ContextMenuService._rootControl.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, invokedHandler);
            }
        }