Exemple #1
0
        void form_Reminder_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                return;
            }
            ContextMenu temp_ContextMenu      = new ContextMenu();
            MenuItem    add_Reminder_MenuItem = new MenuItem("Add Reminder", add_Reminder_MenuItem_Click);

            temp_ContextMenu.MenuItems.Add(add_Reminder_MenuItem);
            Object temp = GetChildAtPoint(e.Location);

            if (temp != null)
            {
                if (temp.ToString().Contains("My_PictureBox"))
                {
                    clicked_My_PictureBox = (My_PictureBox)(temp);
                    MenuItem delete_Reminder_MenuItem = new MenuItem("Delete Reminder", delete_Reminder_MenuItem_Click);
                    temp_ContextMenu.MenuItems.Add(delete_Reminder_MenuItem);
                }
            }
            MenuItem settings_MenuItem = new MenuItem("Settings", settings_Click);

            temp_ContextMenu.MenuItems.Add(settings_MenuItem);
            temp_ContextMenu.Show(this, e.Location);
        }
Exemple #2
0
        public Form_Reminder()
        {
            InitializeComponent();

            crypting_Object = new Useful_Functions.SimpleAES();
            load_Values_From_Registry();

            reset_Event       = new System.Threading.ManualResetEvent(false);
            login_Reset_Event = new System.Threading.ManualResetEvent(false);
            db_Connect        = new DBConnect(database_Server, database_Name, database_Uid, database_Password);

            wipe_Out_The_User_Name_In_The_Registry();
            LoginWindow  login_Window      = new LoginWindow();
            bool         cancel_Pressed    = false;
            Company_Info temp_Company_Info = null;

            login_Window.button_Ok_Login.Click += new EventHandler((sender_0, e_0) =>
            {
                if (login_Window.textBox_Username_Login.Text == "")
                {
                    MessageBox.Show(login_Window, "Username can't be Empty", "Suggestion");
                    return;
                }
                else if (login_Window.textBox_Password_Login.Text == "")
                {
                    MessageBox.Show(login_Window, "Password can't be Empty");
                    return;
                }
                string encrypted_General_password = crypting_Object.EncryptToString(login_Window.textBox_Password_Login.Text);
                if (!db_Connect.Check_User_Account(login_Window.textBox_Username_Login.Text, encrypted_General_password, company_Name))
                {
                    MessageBox.Show(login_Window, "Username/Password is wrong");
                }
                else
                {
                    temp_Company_Info = db_Connect.get_Company_Info_For_This_Company_Name(company_Name);
                    username          = login_Window.textBox_Username_Login.Text;
                    put_This_User_Name_In_The_Registry(username);
                    login_Window.Hide();
                }
                login_Reset_Event.Set();
            });
            login_Window.button_Cancel_Login.Click += new EventHandler((sender_0, e_0) => {
                login_Window.Hide();
                cancel_Pressed = true;
                login_Reset_Event.Set();
            });
            login_Window.FormClosed += new FormClosedEventHandler((sender_0, e_0) => {
                login_Window.Hide();
                cancel_Pressed = true;
                login_Reset_Event.Set();
            });
            login_Window.ShowDialog();
            login_Reset_Event.WaitOne();

            if (cancel_Pressed)
            {
                Environment.Exit(0);
            }

            if (temp_Company_Info != null)
            {
                if (temp_Company_Info.message_Image_Path != "")
                {
                    Welcome_Window temp_Welcome_Window = new Welcome_Window(temp_Company_Info.message_Image_Path, temp_Company_Info.message);
                    temp_Welcome_Window.ShowDialog();
                }
            }

            Initialize_WebSocket();
            reset_Event.WaitOne();

            this.MouseClick += new MouseEventHandler(form_Reminder_MouseClick);

            clicked_My_PictureBox = null;
            picture_Boxes         = new List <My_PictureBox>();
            align_Picture_Boxes();

            this.Load   += new EventHandler(Form_Reminder_Load);
            this.Resize += new EventHandler((sender, e) => {
                if (WindowState == FormWindowState.Minimized)
                {
                    this.Hide();
                }
            });
            this.MinimizeBox = true;
            this.MaximizeBox = false;

            job_Display_Form = new Job_Display_Form();
            job_Display_Form.Hide();

            threads        = new List <System.Threading.Thread>();
            exit_Requested = false;
        }
Exemple #3
0
        void align_Picture_Boxes()
        {
            List <Job> temp_Jobs    = db_Connect.get_All_Reminders_Created_By_This_Person(username, company_Name);
            DateTime   current_Time = DateTime.Now;

            foreach (My_PictureBox temp_My_PictureBox in picture_Boxes)
            {
                this.Controls.Remove(temp_My_PictureBox);
            }
            picture_Boxes.Clear();

            List <Job> beyond_The_Limit_Jobs = new List <Job>();
            List <Job> end_Jobs    = new List <Job>();
            List <Job> middle_Jobs = new List <Job>();
            List <Job> start_Jobs  = new List <Job>();

            for (int i = 0; i < temp_Jobs.Count; ++i)
            {
                if (temp_Jobs[i].get_Status(current_Time) == Job.Status.Beyond_The_Limit)
                {
                    beyond_The_Limit_Jobs.Add(temp_Jobs[i]);
                }
                if (temp_Jobs[i].get_Status(current_Time) == Job.Status.End)
                {
                    end_Jobs.Add(temp_Jobs[i]);
                }
                if (temp_Jobs[i].get_Status(current_Time) == Job.Status.Middle)
                {
                    middle_Jobs.Add(temp_Jobs[i]);
                }
                if (temp_Jobs[i].get_Status(current_Time) == Job.Status.Start)
                {
                    start_Jobs.Add(temp_Jobs[i]);
                }
            }

            List <Job> sorted_Jobs = new List <Job>();

            sorted_Jobs.AddRange(beyond_The_Limit_Jobs);
            sorted_Jobs.AddRange(end_Jobs);
            sorted_Jobs.AddRange(middle_Jobs);
            sorted_Jobs.AddRange(start_Jobs);

            int column_Count = 8;

            for (int i = 0; i < sorted_Jobs.Count; ++i)
            {
                My_PictureBox temp_My_PictureBox = new My_PictureBox(sorted_Jobs[i]);
                int           x = ((i % column_Count) * (temp_My_PictureBox.width)) + ((i % column_Count) * 20) + 20;
                int           y = ((i / column_Count) * temp_My_PictureBox.height) + ((i / column_Count) * 12) + 10;
                temp_My_PictureBox.Location    = new Point(x, y);
                temp_My_PictureBox.MouseHover += new EventHandler(mouse_Hovered);
                temp_My_PictureBox.MouseLeave += new EventHandler((sender, e) =>
                {
                    job_Display_Form.Hide();
                });
                picture_Boxes.Add(temp_My_PictureBox);
                this.Controls.Add(temp_My_PictureBox);
            }

            clicked_My_PictureBox = null;
        }