Example #1
0
        private void timeremind_Tick(object sender, EventArgs e)
        {
            try
            {
                if (QiPao)//若气泡不自动弹出,直接退出。
                {
                    return;
                }

                timeremind.Enabled = false;
                if (IsDelay && DelayTime > 0)
                {
                    DelayTime--;
                    return;
                }
                else
                {
                    IsDelay    = false;
                    DelayIndex = 2;
                }
                if (!MouseOnfrmRemind)
                {
                    if (fnotify == null && remindtime == 0)
                    {
                        if (CheckFormIsOpen("frmNotify"))
                        {
                            fnotify.Close();
                        }
                        DataSet ds = new DataSet();

                        ds = dbHelp.GetPIVAsDB(GetSql());

                        Screen[] screens = Screen.AllScreens;
                        Screen   screen  = screens[0];
                        fnotify                = new frmNotify(this.DEmployeeID);
                        fnotify.setMouseOn    += new frmNotify.MouseOn(SetMouseOnRemind);
                        fnotify.setRemindTime += new frmNotify.RemindTime(setRemindTime);
                        fnotify.setDelayTime  += new frmNotify.DelayTime(setDelayTime);
                        if (ds != null && ds.Tables.Count > 0)
                        {
                            int index1 = 0;
                            int index2 = 0;
                            switch (IniRemTime)
                            {
                            case 60: index1 = 0; break;

                            case 180: index1 = 1; break;

                            case 300: index1 = 2; break;

                            case 600: index1 = 3; break;
                            }
                            switch (keeptime)
                            {
                            case 5: index2 = 0; break;

                            case 10: index2 = 1; break;

                            case 15: index2 = 2; break;

                            case 60: index2 = 3; break;
                            }

                            if (!fnotify.SetRemindForm(ds, index1, index2, DelayIndex))
                            {
                                fnotify.Dispose();
                                fnotify    = null;
                                remindtime = IniRemTime;
                                return;
                            }
                        }
                        else
                        {
                            fnotify.Dispose();
                            fnotify    = null;
                            remindtime = IniRemTime;
                            return;
                        }
                        fnotify.Show();
                        fnotify.Left = screen.WorkingArea.Width - fnotify.Width - 10;
                        fnotify.Top  = screen.WorkingArea.Height;

                        while (fnotify.Top > screen.WorkingArea.Height - fnotify.Height)
                        {
                            Application.DoEvents();
                            fnotify.Top--;
                        }
                        remindtime = IniRemTime;
                    }
                    else
                    {
                        remindtime--;
                        if (remindtime == IniRemTime - keeptime && fnotify != null)//提醒窗体显示一定时间秒后消失
                        {
                            remindtime = IniRemTime;
                            fnotify.Dispose();
                            fnotify = null;
                        }
                    }
                }

                timeremind.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        /// <summary>
        /// 右下角图标双击
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void notify_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            try
            {
                if (QiPaoShuangJi)//若配置双击不可用,直接退出。
                {
                    return;
                }

                DataSet ds = new DataSet();
                ds = dbHelp.GetPIVAsDB(GetSql());
                if (CheckFormIsOpen("frmNotify"))
                {
                    fnotify.Close();
                }
                Screen[] screens = Screen.AllScreens;
                Screen   screen  = screens[0];
                fnotify = new frmNotify(this.DEmployeeID);

                fnotify.setMouseOn    += new frmNotify.MouseOn(SetMouseOnRemind);
                fnotify.setRemindTime += new frmNotify.RemindTime(setRemindTime);
                fnotify.setDelayTime  += new frmNotify.DelayTime(setDelayTime);
                if (ds != null && ds.Tables.Count > 0)
                {
                    int index1 = 0;
                    int index2 = 0;
                    switch (IniRemTime)
                    {
                    case 60: index1 = 0; break;

                    case 180: index1 = 1; break;

                    case 300: index1 = 2; break;

                    case 600: index1 = 3; break;
                    }
                    switch (keeptime)
                    {
                    case 5: index2 = 0; break;

                    case 10: index2 = 1; break;

                    case 15: index2 = 2; break;

                    case 60: index2 = 3; break;
                    }
                    if (!fnotify.SetRemindForm(ds, index1, index2, DelayIndex))
                    {
                        fnotify.Dispose();
                        fnotify    = null;
                        remindtime = IniRemTime;
                        return;
                    }
                }

                fnotify.Show();
                fnotify.Left = screen.WorkingArea.Width - fnotify.Width - 10;
                fnotify.Top  = screen.WorkingArea.Height;

                while (fnotify.Top > screen.WorkingArea.Height - fnotify.Height)
                {
                    Application.DoEvents();
                    fnotify.Top--;
                }
                remindtime = IniRemTime;
            }
            catch (Exception ex)
            {
                ShowMsgHelper.ShowError("右下角图标双击出错:" + ex.Message);
            }
        }