Esempio n. 1
0
        //コンテキストメニューの作成
        public void CheckContextMenu()
        {
            panel.ContextMenu.Items.Clear();
            panel.ContextMenu.Items.Add(new MenuItem()
            {
                Header = String.Format("time = {0} {1}", Text_time.Text, Combo_timeUnit.Text), IsEnabled = false
            });
            MenuItem item;

            item = new MenuItem()
            {
                Header = "Edit Division", IsEnabled = !isLast
            };
            item.Click += (object sender, RoutedEventArgs arg) => editDivision();
            panel.ContextMenu.Items.Add(item);
            item = new MenuItem()
            {
                Header = "Remove This Division", IsEnabled = !isLast
            };
            item.Click += (object sender, RoutedEventArgs arg) => parent.removeDivision(int.Parse((string)Text_columnIndex.Text));
            panel.ContextMenu.Items.Add(item);
        }
Esempio n. 2
0
        //キャンバスのコンテキストメニュー表示
        public void CheckContextMenuOfCanvas()
        {
            int      maxColumn = Grid.GetColumnSpan(canvas);
            bool     isLast    = (maxColumn - 1 == clickedColumn);
            int      myRow     = rowIndex;
            MenuItem item;

            clickedColumn = (int)(Mouse.GetPosition(canvas).X / Division.width);

            canvas.ContextMenu.Items.Clear();
            item = new MenuItem()
            {
                Header = virtualName + " - " + parent.getDivisionName(clickedColumn), IsEnabled = false
            };
            canvas.ContextMenu.Items.Add(item);

            /*
             * canvas.ContextMenu.Items.Add(new Separator());
             * item = new MenuItem() { Header="Edit Value"};
             * item.Click += ((object s, RoutedEventArgs arg) => this.editNode(clickedColumn));
             * canvas.ContextMenu.Items.Add(item);
             */
            item = new MenuItem()
            {
                Header = "Save WaveForm"
            };
            item.Click += ((object s, RoutedEventArgs arg) => this.saveWaveForm());
            canvas.ContextMenu.Items.Add(item);

            canvas.ContextMenu.Items.Add(new Separator());

            MenuItem itemHead;

            itemHead = new MenuItem()
            {
                Header = "Edit Sequence"
            };
            {
                item = new MenuItem()
                {
                    Header = "Insert Division to ←"
                };
                item.Click += ((object s, RoutedEventArgs arg) => parent.insertDivision(clickedColumn));
                itemHead.Items.Add(item);
                item = new MenuItem()
                {
                    Header = "Inert Channel to ↓"
                };
                item.Click += ((object s, RoutedEventArgs arg) => parent.insertChannel(myRow));
                itemHead.Items.Add(item);
                item = new MenuItem()
                {
                    Header = "Remove This Division", IsEnabled = !isLast
                };
                item.Click += ((object s, RoutedEventArgs arg) => parent.removeDivision(clickedColumn));
                itemHead.Items.Add(item);
                item = new MenuItem()
                {
                    Header = "Remove This Channel"
                };
                item.Click += ((object s, RoutedEventArgs arg) => parent.removeChannel(myRow));
                itemHead.Items.Add(item);
            }
            canvas.ContextMenu.Items.Add(itemHead);
        }