Beispiel #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            timerHide = 0;
            string currentPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            dirCommon = Path.GetFullPath(Path.Combine(currentPath, ".."));
            dirCommon = Path.GetFullPath(Path.Combine(dirCommon, "Common"));
            if (File.Exists($"{dirCommon}\\Images\\keyboard-right-arrow-button.png"))
            {
                pbHide.Text = "";
                pbHide.Tag  = "Hide";
                Image img = Image.FromFile($"{dirCommon}\\Images\\keyboard-right-arrow-button.png");
                img          = (Image) new Bitmap(img, 25, 52);
                pbHide.Image = img;
            }
            else
            {
                pbHide.Tag  = "Hide";
                pbHide.Text = "Hide";
            }

            error = "";
            //dataSettings = cS.getSettings("Library Helper Suite", "DeskStats", "false", "STATS");
            lMl = new List <modelLocation>();
            mUd = new modelStat();
            //classFunctions cF = new classFunctions();
            //lMl = (List<modelLocation>)cStats.statControl(dataSettings, controlStats.getLocations, "STATS", "LoadForm",this, null, "", "", false, 0);
            //mUd= (modelStat)cStats.statControl(dataSettings, controlStats.getUserPreferences, "STATS", "LoadForm",this, null, "", "", true, 0);
            //lbLocation.Text = cF.locIDtoString(lMl, mUd.id_loc);
            //cF.setFormButtons(lMl, mUd.id_loc, this);
            //this.Hide();
            //Icon icon = new Icon("piechart.ico");
            // notifyIcon1.Icon = icon;
            timer1.Interval = 1000;
            timer1.Start();
            if (error.ToLower().Contains("error"))
            {
                MessageBox.Show("Error inside application.  Contact IT.  This application will now close"); this.Close();
            }
        }
Beispiel #2
0
        private void DynamicButton_Click(object sender, EventArgs e, Form passedForm)
        {
            controlStats cStats  = new controlStats();
            Form1        frmMain = (Form1)Application.OpenForms["Form1"];

            frmMain.timerHide = 0;
            modelStat mPs = frmMain.mUd;

            mPs.cpu_name  = Environment.MachineName;
            mPs.id_loc    = frmMain.mUd.id_loc;
            mPs.id_user   = frmMain.mUd.id;
            mPs.stat_type = (sender as Button).Text.Split('(')[0].Trim();
            if ((string)(sender as Button).Tag == "time")
            {
            }
            if ((string)(sender as Button).Tag == "string")
            {
            }
            //cStats.statControl(frmMain.dataSettings, controlStats.postStat, "STATS", "FormSetUserPreference", passedForm, null, mPs.stat_type, mPs.stat_comment, false, mPs.id_user);
            if (frmMain.BackColor == Color.Blue)
            {
                frmMain.BackColor = Color.White;
            }
            else if (frmMain.BackColor == Color.White)
            {
                frmMain.BackColor = Color.Blue;
            }
            string strCount    = (sender as Button).Text.Split('(')[1].Replace(")", string.Empty);
            int    countButton = 0;

            if (int.TryParse(strCount, out countButton))
            {
                countButton++;
            }
            (sender as Button).Text = $"{mPs.stat_type}({countButton.ToString()})";
        }