Exemplo n.º 1
0
        private void btn_DropDownTreeView_Click(object sender, EventArgs e)
        {
            if (!Tv_SensorTree.Visible)
            {
                if (Txb_SensorId.Text != string.Empty)
                {
                    foreach (TreeNode node in Tv_SensorTree.Nodes)
                    {
                        CheckAllNodes(node);
                    }
                }
                else
                {
                    Tv_SensorTree.SelectedNode = null;
                }

                saveSelectedNode      = Tv_SensorTree.SelectedNode;
                Tv_SensorTree.Visible = true;
                EnableControls();
                Tv_SensorTree.Focus();
            }
            else
            {
                Tv_SensorTree_SelectionChanged();
            }
        }
Exemplo n.º 2
0
        private void ReportDialog_Load(object sender, EventArgs e)
        {
            btn_DropDownTreeView.Font = new Font("Marlett", btn_DropDownTreeView.Font.Size + 2);

            FillAverages();
            foreach (string scriptName in FolderEngine.GetFileNamesWOExtension(Settings.Instance.ScriptFolder, "*.lua"))
            {
                Cb_ScriptNames.Items.Add(scriptName);
            }
            foreach (string templateName in FolderEngine.GetDirectoryNames(Settings.Instance.TemplateFolder))
            {
                Cb_TemplteNames.Items.Add(templateName);
            }
            Cb_Average.DataSource    = new BindingSource(Averages, null);
            Cb_Average.ValueMember   = "Key";
            Cb_Average.DisplayMember = "Value";


            if (IsInEditMode)
            {
                LoadReport();
            }
            else
            {
                if (Cb_ScriptNames.Items.Count > 0)
                {
                    Cb_ScriptNames.SelectedIndex = 0;
                }

                if (Cb_TemplteNames.Items.Count > 0)
                {
                    Cb_TemplteNames.SelectedIndex = 0;
                }

                Cb_Average.SelectedIndex = 4;
                Txb_BillingFooter.Text   = Settings.Instance.DefaultBillingFooter;
                Txb_BillingHeader.Text   = Settings.Instance.DefaultBillingHeader;
            }

            CreateSensorTree();

            Tv_SensorTree.ExpandAll();
            Tv_SensorTree.Hide();
            Tv_SensorTree.Location     = new Point(Txb_SensorId.Location.X, Txb_SensorId.Location.Y + Txb_SensorId.Height);
            Tv_SensorTree.Size         = new Size(Txb_SensorId.Width + 50, this.Height - Txb_SensorId.Location.Y - Txb_SensorId.Height - 30);
            Tv_SensorTree.SelectedNode = Tv_SensorTree.Nodes[0];

            Txb_SensorId.ReadOnly  = true;
            Txb_SensorId.BackColor = Color.White;

            TogglePercentile();
        }
Exemplo n.º 3
0
        private void Tv_SensorTree_SelectionChanged()
        {
            TreeNode node = Tv_SensorTree.SelectedNode;

            // Avoid runtime error if treeView has nothing in it!
            if (node != null)
            {
                string[] words = node.Text.Split(',');
                int      id;
                bool     ok = int.TryParse(words[words.Length - 1], out id);
                if (ok)
                {
                    saveSelectedNode  = node;
                    Txb_SensorId.Text = node.Text;

                    Tv_SensorTree.Hide();
                    EnableControls();
                }
                else
                {
                    MessageBox.Show("Please select a sensor!");
                }
            }
            else
            {
                if (Txb_SensorId.Text == string.Empty)
                {
                    MessageBox.Show("Please select a sensor!");
                }
                else
                {
                    Tv_SensorTree.Hide();
                    EnableControls();
                }
            }
        }