コード例 #1
0
        public MainWindow(User user, string ipaddress, string password)
        {
            InitializeComponent();

            this.user = user;
            this.password = password;

            this.ipaddress = ipaddress;

            DispatcherTimer startTimer = new DispatcherTimer();
            startTimer.Interval = TimeSpan.FromSeconds(1);
            startTimer.Tick += startTimer_Tick;
            startTimer.Start();

            DispatcherTimer timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromMilliseconds(1);
            timer.Tick += timer_Tick;
            timer.Start();

            DispatcherTimer serverTimer = new DispatcherTimer();
            serverTimer.Interval = TimeSpan.FromMilliseconds(100);
            serverTimer.Tick += serverTimer_Tick;
            serverTimer.Start();

            totalStopWatch.Start();

            nameLbl.Content = user.fname + " " + user.lname;
            shiftLbl.Content = user.shift;

            meetingTimeLbl.Content      = user.totaldurationaux3;
            onDeskTimeLbl.Content       = user.totaldurationaux7;
            shortBreakTimeLbl.Content   = user.totaldurationaux8;
            longBreakTimeLbl.Content    = user.totaldurationaux9;
            totalTimeLbl.Content        = user.totalduration;
        }
コード例 #2
0
        void timer_Tick(object sender, EventArgs e)
        {
            using (WebClient wc = new WebClient())
            {
                string url = "http://" + ipaddress + "/users/employeelogin?employeeid=" + this.user.employeeid + "&attendanceid=" + this.user.attendanceid + "&password="******"1" && json != "2")
                {
                    this.user = JsonConvert.DeserializeObject<User>(json);

                    meetingTimeLbl.Content = this.user.totaldurationaux3;
                    onDeskTimeLbl.Content = this.user.totaldurationaux7;
                    shortBreakTimeLbl.Content = this.user.totaldurationaux8;
                    longBreakTimeLbl.Content = this.user.totaldurationaux9;
                    totalTimeLbl.Content = user.totalduration;

                    meetingBtn.IsEnabled = user.isMeetingEnable;
                    onDeskBtn.IsEnabled = user.isOnDeskEnable;
                    shortBreakBtn.IsEnabled = user.isShortBreakEnable;
                    longBreakBtn.IsEnabled = user.isLongBreakEnable;
                }
            }

            if (this.user.isShortOverBreak && isOverShortBreak == false)
            {
                isOverShortBreak = true;
                this.Activate();
                MessageBox.Show("OVER BREAK OVER BREAK OVERBREAK!!!");
                shortBreakTimeLbl.Foreground = Brushes.Red;
            }

            if (this.user.isLongOverBreak && isOverLongBreak == false)
            {
                isOverLongBreak = true;
                this.Activate();
                MessageBox.Show("OVER BREAK OVER BREAK OVERBREAK!!!");
                longBreakTimeLbl.Foreground = Brushes.Red;
            }

            if (this.user.isShortOverBreakWarning && isOverShortBreakWarning == false)
            {
                isOverShortBreakWarning = true;
                this.Activate();
                MessageBox.Show("Warning 5 mins left!");
            }

            if (this.user.isLongOverBreakWarning && isOverLongBreakWarning == false)
            {
                isOverLongBreakWarning = true;
                this.Activate();
                MessageBox.Show("Warning 5 mins left!");
            }
        }
コード例 #3
0
        private void ShortBreakButton_Click(object sender, RoutedEventArgs e)
        {
            this.Activate();
            MessageBox.Show("Please change to AUX8 in your AVAYA Phone.");

            setStatusLabel((Button)sender);

            statusState = StatusState.StatusStateShortBreak;

            using (WebClient wc = new WebClient())
            {
                string url = "http://" + ipaddress + "/users/updateattendancelog?logstatus=" + 3 + "&previouslogstatus=" + user.currentlogid + "&employeeid=" + this.user.employeeid;

                var json = wc.DownloadString(url);

                if (json != "1" && json != "2")
                {
                    this.user = JsonConvert.DeserializeObject<User>(json);

                    meetingTimeLbl.Content = this.user.totaldurationaux3;
                    onDeskTimeLbl.Content = this.user.totaldurationaux7;
                    shortBreakTimeLbl.Content = this.user.totaldurationaux8;
                    longBreakTimeLbl.Content = this.user.totaldurationaux9;
                    totalTimeLbl.Content = user.totalduration;
                }
            }
        }