//コンストラクタ public Division(Sequence _parent) { parent = _parent; panel = new StackPanel() { Orientation = Orientation.Vertical, ContextMenu = new ContextMenu() }; { Text_columnIndex = new TextBlock() { Text = uniqueId.ToString() ,ContextMenu = null }; Text_columnIndex.ContextMenuOpening += ((object sender, ContextMenuEventArgs arg) => CheckContextMenu()); panel.Children.Add(Text_columnIndex); } { Text_name = new TextBox() { Text = "Div " + uniqueId, Background = Brushes.LightGray, ContextMenu = null }; Text_name.ContextMenuOpening += ((object sender, ContextMenuEventArgs arg) => CheckContextMenu()); panel.Children.Add(Text_name); } { StackPanel miniStack = new StackPanel() { Orientation = Orientation.Horizontal }; Text_time = new TextBox() { Text = "1", Background = Brushes.LightGray, ContextMenu = null, Width = Division.width / 2 }; Text_time.ContextMenuOpening += ((object sender, ContextMenuEventArgs arg) => CheckContextMenu()); Combo_timeUnit = new ComboBox() { ContextMenu = null ,Width=Division.width/2}; foreach (String tu in Enum.GetNames(typeof(TimeUnit))) { Combo_timeUnit.Items.Add(tu); } Combo_timeUnit.ContextMenuOpening += ((object sender, ContextMenuEventArgs arg) => CheckContextMenu()); Combo_timeUnit.SelectedIndex = 0; miniStack.Children.Add(Text_time); miniStack.Children.Add(Combo_timeUnit); panel.Children.Add(miniStack); } uniqueId++; }
//シーケンスに読み込み public void loadCurrentSeq(string text) { Sequence nseq = new Sequence(); try { nseq.fromSeq(text); sequences[currentId] = nseq; } catch (Exception e) { throw e; } }
//コンストラクタ public Channel(Sequence _parent, int divisionCount) { parent = _parent; nodes = new List<Node>(); panel = new StackPanel() { }; Text_rowIndex = new TextBlock() { Background=Brushes.Black , Foreground=Brushes.White }; Text_virtualName = new TextBox() { Text = "IO " + uniqueId, Background = Brushes.LightGray, ContextMenu = new ContextMenu() }; Text_rowIndex.ContextMenuOpening += (object sender, ContextMenuEventArgs arg) => CheckContextMenuOfLabel(); uniqueId++; ADCombo = new ComboBox() { }; ADCombo.Items.Add("Analog"); ADCombo.Items.Add("Digital"); ADCombo.SelectedIndex = 0; ADCombo.SelectionChanged += ((s, e) => updateItemList()); IOCombo = new ComboBox() { }; IOCombo.Items.Add("Out"); IOCombo.Items.Add("In"); IOCombo.SelectedIndex = 0; IOCombo.SelectionChanged += ((s, e) => updateItemList()); // IOCombo.IsEnabled = false; Combo_channelName = new ComboBox() { }; foreach (string str in TaskManager.GetInstance().getAnalogOutputList()) { Combo_channelName.Items.Add(str); } Text_minVoltage = new TextBox() { Text = "-1" , Width=40}; Text_minVoltage.TextChanged += (s, e) => repaint(); Text_maxVoltage = new TextBox() { Text = "1", Width=40 }; Text_maxVoltage.TextChanged += (s, e) => repaint(); panel.Children.Add(Text_rowIndex); panel.Children.Add(Text_virtualName); { StackPanel miniStack = new StackPanel() { Orientation = Orientation.Horizontal }; miniStack.Children.Add(ADCombo); miniStack.Children.Add(IOCombo); panel.Children.Add(miniStack); } panel.Children.Add(Combo_channelName); { StackPanel miniStack = new StackPanel() { Orientation = Orientation.Horizontal }; miniStack.Children.Add(Text_minVoltage); miniStack.Children.Add(new Label() { Content = "V ~ " }); miniStack.Children.Add(Text_maxVoltage); miniStack.Children.Add(new Label() { Content = "V" }); panel.Children.Add(miniStack); } for (int i = 0; i < divisionCount - 1; i++) { nodes.Add(new Node(this) { index = i, value = 0, type = NodeType.Hold, isEnd = false }); } nodes.Add(new Node(this) { index = divisionCount-1, value = 0, type = NodeType.Hold, isEnd = true }); canvas = new Canvas() { Background = Brushes.White, ContextMenu = new ContextMenu() }; canvas.SetValue(Grid.ColumnSpanProperty, divisionCount); canvas.ContextMenuOpening += (object sender, ContextMenuEventArgs e) => CheckContextMenuOfCanvas(); repaintValueBoxes(); }