public GSEditor_GenLine(Canvas can, Generator gen, TextBox tbName, ComboBox cbType, TextBox tbSdw, TextBox tbDlit) { try { TBName = tbName; CBType = cbType; CBType.SelectionChanged += CBType_SelectionChanged; TBSdw = tbSdw; TBSdw.PreviewTextInput += TBSdw_PreviewTextInput; TBSdw.TextChanged += TBSdw_TextChanged; TBDlit = tbDlit; TBDlit.PreviewTextInput += TBDlit_PreviewTextInput; TBDlit.TextChanged += TBDlit_TextChanged; Can = can; Can.Loaded += Can_Loaded; Can.MouseLeftButtonDown += Can_MouseLeftButtonDown; Can.MouseMove += Can_MouseMove; Can.MouseLeave += Can_MouseLeave; Can.ToolTip = TTCan; Gen = gen; switch (gen.Type) { case Generator.DNRZ: TBSdw.IsEnabled = false; TBDlit.IsEnabled = false; ChType = Change.Zero; break; case Generator.NRZ: TBDlit.IsEnabled = false; ChType = Change.Zero; break; case Generator.RZ: ChType = Change.One; break; case Generator.R1: ChType = Change.Zero; break; default: ChType = Change.Zero; break; } } catch (Exception Ex) { Error Err = new Error(0, FileNameForErr, ClassNameForErr, "GSEditor_GenLine", Ex.ToString()); if (App.isDebugMode) MessageBox.Show(Err.ToString()); else Error.Add(Err); } }
public SignalLine(Signal signal, TreeViewItem LBILine, GlobalLine GLine, MainWindow Wnd) { Type = DrawingLine.Types.Signal; wnd = Wnd; Parent = GLine; //------------------- Creating Canvas ------------------------------------ CanLine = new Canvas(); CanLine.Height = Settings.LineHeight -2; CanLine.VerticalAlignment = VerticalAlignment.Top; CanLine.HorizontalAlignment = HorizontalAlignment.Stretch; CanLine.Background = Brushes.Transparent; CanLine.Margin = new Thickness(-18, 0, 0, 0); LBILine.Header = CanLine; //------------------------------------------------------------------------- // Context Menu MenuItem MITemp = new MenuItem { Header = "0"}; MITemp.Click += MISetZero_Click; CMCanLine.Items.Add(MITemp); MITemp = new MenuItem { Header = "1" }; MITemp.Click += MISetOne_Click; CMCanLine.Items.Add(MITemp); MITemp = new MenuItem { Header = "#" }; MITemp.Click += MISetHash_Click; CMCanLine.Items.Add(MITemp); MITemp = new MenuItem { Header = "*" }; MITemp.Click += MISetStar_Click; CMCanLine.Items.Add(MITemp); MITemp = new MenuItem { Header = "Z" }; MITemp.Click += MISetZ_Click; CMCanLine.Items.Add(MITemp); MITemp = new MenuItem { Header = "X" }; MITemp.Click += MISetX_Click; CMCanLine.Items.Add(MITemp); MITemp = new MenuItem { Header = "Удалить" }; MITemp.Click += MIDelete_Click; CMCanLine.Items.Add(MITemp); CanLine.ContextMenu = CMCanLine; //Signal = signal; Source = signal; //------------------------------------------------------------------------- RenewContextMenuVisibility(); Gen = Project.Gens.Pot; //Redraw(); }
public int IndexOf(Generator Gen) { return Gens.IndexOf(Gen); }
public void Add(Generator Gen) { Gens.Add(Gen); }
// Creating new GenLine void New_Gen(Generator Gen) { try { int ItemHeight = Settings_GenStrobEditor.ItemHeight; //------------ Название ---------------------------------------------------- TextBox TBGenName = new TextBox { Text = Gen.Name, VerticalAlignment = VerticalAlignment.Center, ContextMenu = CMGens }; LBGenName.Items.Add(new ListBoxItem { Content = TBGenName, ContextMenu = CMGens, Height = ItemHeight, BorderBrush = Brushes.Gray }); //------------ Тип ------------------------------------------------------------ ComboBox CBGenType = new ComboBox { Items = { "DNRZ", "NRZ", "R0(RZ)", "R1" }, SelectedIndex = Gen.Type, VerticalAlignment = VerticalAlignment.Center, ContextMenu = CMGens }; LBGenType.Items.Add(new ListBoxItem { Content = CBGenType, ContextMenu = CMGens, Height = ItemHeight, BorderBrush = Brushes.Gray }); //------------ Сдвиг --------------------------------------------------------- TextBox TBGenSdw = new TextBox { Text = Gen.Sdw.ToString(), ContextMenu = CMGens, VerticalAlignment = VerticalAlignment.Center }; LBGenSdw.Items.Add(new ListBoxItem { Content = TBGenSdw, ContextMenu = CMGens, Height = ItemHeight, BorderBrush = Brushes.Gray }); //------------ Длительность -------------------------------------------------- TextBox TBGenDlit = new TextBox { Text = Gen.Dlit.ToString(), ContextMenu = CMGens, VerticalAlignment = VerticalAlignment.Center }; LBGenDlit.Items.Add(new ListBoxItem { Content = TBGenDlit, ContextMenu = CMGens, Height = ItemHeight, BorderBrush = Brushes.Gray }); //------------ Редактор ------------------------------------------------------- Canvas Can = new Canvas { Background = Brushes.Black , Height = ItemHeight - 3}; LBGenCans.Items.Add(new ListBoxItem { ContextMenu = CMCanvas, Height = ItemHeight, Content = Can }); GenLines.Add(new GSEditor_GenLine(Can, Gen, TBGenName, CBGenType, TBGenSdw, TBGenDlit)); } catch (Exception Ex) { Error Err = new Error(0, FileNameForErr, ClassNameForErr, "New_Gen", Ex.ToString()); if (App.isDebugMode) System.Windows.MessageBox.Show(Err.ToString()); else Error.Add(Err); } }