private void newItemBTN_Click(object sender, EventArgs e) { try { var selectedNode = itemsTV.SelectedNode; if (selectedNode == null || selectedNode.Tag == null) { return; } else if (selectedNode.Tag.GetType() != typeof(ServerLog)) { GroupLog selectedGroup = (GroupLog)itemsTV.SelectedNode.Tag; if (selectedGroup != null) { //selectedGroup.NewItemDialog(); var itemForm = new ObjectsForm(); itemForm.showForm(selectedGroup); } return; } } catch (Exception exception) { ClientUtils.HandleException(this.Text, exception); } }
public async Task showForm(GroupLog group) { m_groupLog = group; await PopulateBranch(ObjectIds.ObjectsFolder, BrowseNodesTV.Nodes); ShowDialog(); }
private void addItem(ItemConf itemConf, GroupLog groupLog) { try { groupLog.CreateMonitoredItem(itemConf.ID, itemConf.Name); } catch (Exception exception) { ClientUtils.HandleException(this.Text, exception); } }
public GroupForm(GroupLog group) { InitializeComponent(); m_group = group; selectFileCtrl1.FilePathControl = filePathTB; selectFileCtrl1.Filter = "CSV Files (*.csv)|*.csv|All Files(*.*)|*.*"; nameTB.Text = group.Name; filePathTB.Text = m_group.FilePath; updatePeriodNUD.Value = m_group.UpdatePeriod; appendDateCB.Checked = m_group.LogFileSettings.AppendDate; logRateNUD.Value = m_group.LogRate; appendTimeCB.Checked = m_group.LogFileSettings.AppendTime; afterDurationCB.Checked = m_group.LogFileSettings.CreationAfterDuration; afterDurationNUD.Value = m_group.LogFileSettings.CADDuration; }
private void addGroup(GroupConf groupConf, ServerLog server) { var newGroup = new GroupLog(); newGroup.Name = groupConf.Name; newGroup.FilePath = groupConf.CSVPath; newGroup.UpdatePeriod = groupConf.UpdatePeriod; newGroup.LogRate = groupConf.LogRate; newGroup.LogFileSettings = groupConf.LogFileSettings; newGroup.Server = server; newGroup.Server.GroupLogs.Add(newGroup); foreach (ItemConf itemConf in groupConf.ItemConfs) { addItem(itemConf, newGroup); } }
private void stopLoggingBTN_Click(object sender, EventArgs e) { try { GroupLog selectedGroup = (GroupLog)itemsTV.SelectedNode.Tag; if (selectedGroup != null) { selectedGroup.StopLogging(); startLoggingBTN.Enabled = true; pauseLoggingBTN.Enabled = false; stopLoggingBTN.Enabled = false; } } catch (Exception exception) { ClientUtils.HandleException(this.Text, exception); } }
private void addGroup(GroupConf groupConf, ServerLog server) { var searchNodes = itemsTV.Nodes[0].Nodes.OfType <TreeNode>(); var serverNode = searchNodes.FirstOrDefault(node => node.Tag != null && node.Tag.Equals(server)); if (serverNode == null) { return; } var newGroup = new GroupLog(); newGroup.Name = groupConf.Name; newGroup.FilePath = groupConf.CSVPath; newGroup.UpdatePeriod = groupConf.UpdatePeriod; newGroup.LogRate = groupConf.LogRate; newGroup.LogFileSettings = groupConf.LogFileSettings; newGroup.Server = server; newGroup.Server.GroupLogs.Add(newGroup); newGroup.ItemAction += itemAction; // add node. TreeNode groupNode = new TreeNode(newGroup.Name); groupNode.Tag = newGroup; serverNode.Nodes.Add(groupNode); serverNode.Expand(); MonitoredItemsListCTRL listCTRL = new MonitoredItemsListCTRL(); newGroup.Handle = listCTRL; foreach (ItemConf itemConf in groupConf.ItemConfs) { addItem(itemConf, newGroup); } }
private void newGroupBTN_Click(object sender, EventArgs e) { try { var selectedNode = itemsTV.SelectedNode; if (selectedNode == null || selectedNode.Tag == null || selectedNode.Tag.GetType() != typeof(ServerLog)) { return; } var newGroup = new GroupLog(); newGroup.Name = "Group"; newGroup.Server = (ServerLog)selectedNode.Tag; ; if (new GroupForm(newGroup).ShowDialog() != DialogResult.OK) { return; } newGroup.Server.GroupLogs.Add(newGroup); newGroup.ItemAction += itemAction; // add node. TreeNode groupNode = new TreeNode(newGroup.Name); groupNode.Tag = newGroup; selectedNode.Nodes.Add(groupNode); selectedNode.Expand(); MonitoredItemsListCTRL listCTRL = new MonitoredItemsListCTRL(); newGroup.Handle = listCTRL; } catch (Exception exception) { ClientUtils.HandleException(this.Text, exception); } }
private void itemsTV_AfterSelect(object sender, TreeViewEventArgs e) { try { preferencesBTN.Enabled = true; if (itemsTV.SelectedNode.Tag == null) { newToolStripMenuItem1.Enabled = true; editToolStripMenuItem.Enabled = false; deleteToolStripMenuItem.Enabled = false; return; } if (itemsTV.SelectedNode.Tag.GetType() == typeof(GroupLog)) { newToolStripMenuItem1.Enabled = true; editToolStripMenuItem.Enabled = true; deleteToolStripMenuItem.Enabled = true; GroupLog selectedGroup = (GroupLog)itemsTV.SelectedNode.Tag; newItemBTN.Enabled = true; newGroupBTN.Enabled = false; splitContainer1.Panel2.Controls.Clear(); var listCtrl = (MonitoredItemsListCTRL)selectedGroup.Handle; splitContainer1.Panel2.Controls.Add(listCtrl); listCtrl.Dock = DockStyle.Fill; if (selectedGroup.IsLogging && !selectedGroup.IsLoggingPaused) { startLoggingBTN.Enabled = false; pauseLoggingBTN.Enabled = true; stopLoggingBTN.Enabled = true; } else if (selectedGroup.IsLogging && selectedGroup.IsLoggingPaused) { startLoggingBTN.Enabled = true; pauseLoggingBTN.Enabled = false; stopLoggingBTN.Enabled = true; } else { startLoggingBTN.Enabled = true; pauseLoggingBTN.Enabled = false; stopLoggingBTN.Enabled = false; } } else if (itemsTV.SelectedNode.Tag.GetType() == typeof(ServerLog)) { newToolStripMenuItem1.Enabled = true; editToolStripMenuItem.Enabled = true; deleteToolStripMenuItem.Enabled = true; startLoggingBTN.Enabled = false; pauseLoggingBTN.Enabled = false; stopLoggingBTN.Enabled = false; newGroupBTN.Enabled = true; newItemBTN.Enabled = false; } else if (itemsTV.SelectedNode.Tag.GetType() == typeof(ItemLog)) { newToolStripMenuItem1.Enabled = false; editToolStripMenuItem.Enabled = false; deleteToolStripMenuItem.Enabled = true; } } catch (Exception exception) { ClientUtils.HandleException(this.Text, exception); } }