private void Can_Loaded(object sender, RoutedEventArgs e)
 {
     TLine = new TaktLine(VisualSource.Source.Per, Can);
     TLine.Redraw(VisualSource.Source.Per);
     Draw();
     Can.MouseLeftButtonDown+=Can_MouseLeftButtonDown;
     Can.MouseMove += Can_MouseMove;
     Can.MouseLeftButtonUp += Can_MouseLeftButtonUp;
     Can.PreviewMouseRightButtonDown += Can_PreviewMouseRightButtonDown;
     MenuItem CMIZero = new MenuItem { Header = "0" };
     CMIZero.Click += CMIZero_Click;
     CMCan.Items.Add(CMIZero);
     MenuItem CMIOne = new MenuItem { Header = "1" };
     CMIOne.Click += CMIOne_Click;
     CMCan.Items.Add(CMIOne);
     MenuItem CMIHash = new MenuItem { Header = "#" };
     CMIHash.Click += CMIHash_Click;
     CMCan.Items.Add(CMIHash);
     MenuItem CMIStar = new MenuItem { Header = "*" };
     CMIStar.Click += CMIStar_Click;
     CMCan.Items.Add(CMIStar);
     MenuItem CMIZ = new MenuItem { Header = "Z" };
     CMIZ.Click += CMIZ_Click;
     CMCan.Items.Add(CMIZ);
     MenuItem CMIX = new MenuItem { Header = "X" };
     CMIX.Click += CMIX_Click;
     CMCan.Items.Add(CMIX);
     MenuItem CMIDel = new MenuItem { Header = "Удалить" };
     CMIDel.Click += CMIDel_Click;
     CMCan.Items.Add(CMIDel);
     Can.ContextMenu = CMCan;
 }
Exemple #2
0
        private void CanTop_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                BaseLine = new Marker("Base", Marker.BaseLine, 0, this);
                CursorLine = new Marker("Cursor", Marker.CursorLine, 0, this);
                EndLine = new Marker("End", Marker.EndLine, TaktCount * Project.TTakt, this);
                ValueMarker = CursorLine;
                //drawing scale and takt lines when CanTop.ActualWidth != 0 (CanTop.Width != null) (when CanTop and others(GTop and GBottom) is loaded)
                TimeLines = new TimeLine(this);
                Takts = new TaktLine(this, CanTop);
                CanTop.MouseDown += new MouseButtonEventHandler(CanTop_MouseDown);
                CanTop.MouseUp += new MouseButtonEventHandler(CanTop_MouseUp);
                CanTop.MouseMove += new MouseEventHandler(CanTop_MouseMove);
                CanTop.MouseLeave += new MouseEventHandler(CanTop_MouseLeave);

                ContextMenu CMMarkerNew = new ContextMenu();
                MenuItem MIMarkerNew = new MenuItem();
                MIMarkerNew.Header = "Новый маркер";
                MIMarkerNew.Click += new RoutedEventHandler(MIMarkerNew_Click);
                CMMarkerNew.Items.Add(MIMarkerNew);
                CanTop.ContextMenu = CMMarkerNew;
                ComplexRedraw();
            }
            catch (Exception Ex)
            {
                Error Err = new Error(0, "MainWindow.cs", "MainWindow", "CanTop_Loaded", Ex.ToString());
                if (App.isDebugMode)
                    MessageBox.Show(Err.ToString());
                else
                    Error.Add(Err);
            }
        }