Exemplo n.º 1
0
 public frmMain(UC_Recurring ucRecurringLoad)
     : this()
 {
     this.ucRecurring = ucRecurringLoad;
 }
Exemplo n.º 2
0
        private void tsbtnRefesh_Click(object sender, EventArgs e)
        {
            UC_Recurring.Sort();

            if (panelContent.Controls.Count > 1 && flagRefresh != 7)
                panelContent.Controls.RemoveAt(1); // 1 = UC_HienTai ; 0 = Status Strip

            if (flagRefresh == 1)
            {
                ucRecurring = new UC_Recurring();
                panelContent.Controls.Add(ucRecurring);
            }

            if (flagRefresh == 2)
            {
                panelContent.Controls.Add(ucIdea);
            }

            if (flagRefresh == 3)
            {
                this.ucSchedule.LoadListView();
            }

            if (flagRefresh == 4)
            {
                ucAlarm = new UC_Clock();
                panelContent.Controls.Add(ucAlarm);
            }

            if (flagRefresh == 5)
            {
                panelContent.Controls.Add(ucDictionary);
            }

            if (flagRefresh == 6)
            {
                panelContent.Controls.Add(ucFavorite);
            }

            if (flagRefresh == 7)
            {
                Download();
                this.ucSticky.LoadListView();
            }

            if (flagRefresh == 8)
            {
                tsbtnAccount_Click(sender, e);
            }

            if (flagRefresh == 9)
            {

            }
        }
Exemplo n.º 3
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            Connect();
            Download();

            //this.WindowState = FormWindowState.Minimized;
            ////this.Hide();
            //fIntro.Show();

            #region Chế độ hiển thị khi khởi động chương trình

            try
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(Application.StartupPath + "/Config.xml");

                XmlElement ele = doc.DocumentElement;
                XmlNodeList TaskList = ele.GetElementsByTagName("DS_Config");

                notifyIcon.Visible = false;

                for (int i = 0; i < TaskList.Count; i++)
                {
                    strLanguage = Decryption(TaskList[i].ChildNodes[2].InnerText);
                    strTheme = Decryption(TaskList[i].ChildNodes[3].InnerText);
                    if (Decryption(TaskList[i].ChildNodes[0].InnerText) == "True" && Decryption(TaskList[i].ChildNodes[1].InnerText) == "Mini")
                    {
                        this.WindowState = FormWindowState.Minimized;
                        this.ShowInTaskbar = false;
                        notifyIcon.Visible = true;
                    }
                    else
                    {
                        notifyIcon.Visible = false;
                    }

                    if (Decryption(TaskList[i].ChildNodes[5].InnerText) == "Yes")
                    {
                        frmTaskOfTheDay totd = new frmTaskOfTheDay();
                        totd.Show();
                    }
                }
            }
            catch
            {
                //if (File.Exists(Application.StartupPath + "/Config.xml"))
                //{
                //    File.Delete("Config.xml.bk");
                //    File.Copy(Application.StartupPath + "/Config.xml", "Config.xml.bk");
                //    File.Delete(Application.StartupPath + "/Config.xml");
                //}

                //XmlTextWriter writer = new XmlTextWriter(Application.StartupPath + "/Config.xml", Encoding.UTF8);
                //writer.Formatting = Formatting.Indented;
                ////Create XML
                //writer.WriteStartDocument();
                ////Create Root
                //writer.WriteStartElement("Config");
                //writer.WriteEndElement();
                //writer.WriteEndDocument();
                //writer.Flush();
                //writer.Close();

                if (File.Exists(Application.StartupPath + "/Config.xml"))
                {
                    File.Delete(Application.StartupPath + "/Config.xml");
                }

                using (FileStream fileStream = File.Create(Application.StartupPath + "/Config.xml"))
                {
                    myAssembly.GetManifestResourceStream("Reminiscent.Resources.XML.Config.xml").CopyTo(fileStream);
                }

                MessageBox.Show("Your config database have been corrupted! \n\n It have been backup and created a new one.", "Warring", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            #endregion

            timerMain.Start();

            classShowSticky.Load();

            #region Language

            if (!Directory.Exists(Application.StartupPath + "/Language"))
            {
                Directory.CreateDirectory(Application.StartupPath + "/Language");
            }
            if (!File.Exists(Application.StartupPath + "/Language/Language-English.xml"))
            {
                using (FileStream fileStream = File.Create(Application.StartupPath + "/Language/Language-English.xml"))
                {
                    myAssembly.GetManifestResourceStream("Reminiscent.Resources.XML.Language-English.xml").CopyTo(fileStream);
                }
            }
            if (!File.Exists(Application.StartupPath + "/Language/Language-Vietnamese.xml"))
            {
                using (FileStream fileStream = File.Create(Application.StartupPath + "/Language/Language-Vietnamese.xml"))
                {
                    myAssembly.GetManifestResourceStream("Reminiscent.Resources.XML.Language-Vietnamese.xml").CopyTo(fileStream);
                }
            }

            XmlDocument xmlDocLng = new XmlDocument();
            if (strLanguage == "English")
            {
                xmlDocLng.Load(Application.StartupPath + "/Language/Language-English.xml");
            }
            else if (strLanguage == "Vietnamese")
            {
                xmlDocLng.Load(Application.StartupPath + "/Language/Language-Vietnamese.xml");
            }

            foreach (XmlNode node in xmlDocLng.SelectNodes("Language/Form"))
            {
                try
                {
                    if (Decryption(node.SelectSingleNode("Name").InnerText) == this.Name)
                    {
                        //MenuStrip
                        fileToolStripMenuItem.Text = Decryption(node.SelectSingleNode("MenuStrip").SelectSingleNode("Item1").SelectSingleNode("ItemName").InnerText);
                        importToolStripMenuItem.Text = Decryption(node.SelectSingleNode("MenuStrip").SelectSingleNode("Item1").SelectSingleNode("Child1").InnerText);
                        exportToolStripMenuItem.Text = Decryption(node.SelectSingleNode("MenuStrip").SelectSingleNode("Item1").SelectSingleNode("Child2").InnerText);
                        optionToolStripMenuItem.Text = Decryption(node.SelectSingleNode("MenuStrip").SelectSingleNode("Item1").SelectSingleNode("Child3").InnerText);
                        exitToolStripMenuItem.Text = Decryption(node.SelectSingleNode("MenuStrip").SelectSingleNode("Item1").SelectSingleNode("Child4").InnerText);

                        //ToolStrip
                        tsbtnRecurring.Text = Decryption(node.SelectSingleNode("ToolStrip").SelectSingleNode("btn1").InnerText);
                        tsbtnIdea.Text = Decryption(node.SelectSingleNode("ToolStrip").SelectSingleNode("btn2").InnerText);
                        tsbtnSchedule.Text = Decryption(node.SelectSingleNode("ToolStrip").SelectSingleNode("btn3").InnerText);
                        tsbtnAlarm.Text = Decryption(node.SelectSingleNode("ToolStrip").SelectSingleNode("btn4").InnerText);
                        tsbtnDictionary.Text = Decryption(node.SelectSingleNode("ToolStrip").SelectSingleNode("btn5").InnerText);
                        tsbtnFavorite.Text = Decryption(node.SelectSingleNode("ToolStrip").SelectSingleNode("btn6").InnerText);
                        tsbtnSticky.Text = Decryption(node.SelectSingleNode("ToolStrip").SelectSingleNode("btn7").InnerText);
                        tsbtnAccount.Text = Decryption(node.SelectSingleNode("ToolStrip").SelectSingleNode("btn8").InnerText);
                        tsbtnOthers.Text = Decryption(node.SelectSingleNode("ToolStrip").SelectSingleNode("btn9").InnerText);
                        tsbtnRefesh.Text = Decryption(node.SelectSingleNode("ToolStrip").SelectSingleNode("btn10").InnerText);
                        tsbtnToday.Text = Decryption(node.SelectSingleNode("ToolStrip").SelectSingleNode("btn11").InnerText);
                        tsbtnSearch.Text = Decryption(node.SelectSingleNode("ToolStrip").SelectSingleNode("btn12").InnerText);
                        break;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error: " + ex + " " + node.SelectSingleNode("Name").InnerText);
                }
            }

            #endregion

            #region Theme
            if (!Directory.Exists(Application.StartupPath + "/Theme"))
            {
                Directory.CreateDirectory(Application.StartupPath + "/Theme");
            }
            if (!File.Exists(Application.StartupPath + "/Theme/Theme-Blue.xml"))
            {
                using (FileStream fileStream = File.Create(Application.StartupPath + "/Theme/Theme-Blue.xml"))
                {
                    myAssembly.GetManifestResourceStream("Reminiscent.Resources.XML.Theme-Blue.xml").CopyTo(fileStream);
                }
            }
            if (!File.Exists(Application.StartupPath + "/Theme/Theme-White.xml"))
            {
                using (FileStream fileStream = File.Create(Application.StartupPath + "/Theme/Theme-White.xml"))
                {
                    myAssembly.GetManifestResourceStream("Reminiscent.Resources.XML.Theme-White.xml").CopyTo(fileStream);
                }
            }
            if (!File.Exists(Application.StartupPath + "/Theme/Theme-Simple.xml"))
            {
                using (FileStream fileStream = File.Create(Application.StartupPath + "/Theme/Theme-Simple.xml"))
                {
                    myAssembly.GetManifestResourceStream("Reminiscent.Resources.XML.Theme-Simple.xml").CopyTo(fileStream);
                }
            }

            XmlDocument xmlDocTheme = new XmlDocument();
            if (strTheme == "Blue")
            {
                xmlDocTheme.Load(Application.StartupPath + "/Theme/Theme-Blue.xml");
            }
            else if (strTheme == "White")
            {
                xmlDocTheme.Load(Application.StartupPath + "/Theme/Theme-White.xml");
            }
            else if (strTheme == "Simple")
            {
                xmlDocTheme.Load(Application.StartupPath + "/Theme/Theme-Simple.xml");
            }

            foreach (XmlNode node in xmlDocTheme.SelectNodes("Theme/Style"))
            {
                if (frmMain.Decryption(node.SelectSingleNode("Name").InnerText) == strTheme)
                {
                    int ibc11 = Convert.ToInt32(frmMain.Decryption(node.SelectSingleNode("bc11").InnerText));
                    int ibc12 = Convert.ToInt32(frmMain.Decryption(node.SelectSingleNode("bc12").InnerText));
                    int ibc13 = Convert.ToInt32(frmMain.Decryption(node.SelectSingleNode("bc13").InnerText));

                    int ibc21 = Convert.ToInt32(frmMain.Decryption(node.SelectSingleNode("bc21").InnerText));
                    int ibc22 = Convert.ToInt32(frmMain.Decryption(node.SelectSingleNode("bc22").InnerText));
                    int ibc23 = Convert.ToInt32(frmMain.Decryption(node.SelectSingleNode("bc23").InnerText));

                    menuStrip1.BackColor = Color.FromArgb(ibc11, ibc12, ibc13);
                    menuStrip1.BackgroundImage = new Bitmap(myAssembly.GetManifestResourceStream(frmMain.Decryption(node.SelectSingleNode("bg4").InnerText)));

                    panelMenu.BackColor = Color.FromArgb(ibc11, ibc12, ibc13);
                    panelMenu.BackgroundImage = new Bitmap(myAssembly.GetManifestResourceStream(frmMain.Decryption(node.SelectSingleNode("bg3").InnerText)));

                    panelContent.BackColor = Color.FromArgb(ibc11, ibc12, ibc13);
                    panelContent.BackgroundImage = new Bitmap(myAssembly.GetManifestResourceStream(frmMain.Decryption(node.SelectSingleNode("bg1").InnerText)));

                    statusStrip.BackColor = Color.FromArgb(ibc21, ibc22, ibc23);
                    break;
                }
            }
            #endregion

            ucRecurring = new UC_Recurring();
            ucIdea = new UC_Idea();
            ucSchedule = new UC_Schedule();
            ucAlarm = new UC_Clock();
            ucDictionary = new UC_Dictionary();
            ucFavorite = new UC_Favorite();
            //ucFavoriteAudios = new UC_FavoriteAudios();
            //ucFavoriteVideos = new UC_FavoriteVideos();
            ucSticky = new UC_Sticky();
            ucOthers = new UC_Others();
            //ucAccount = new UC_Account();
            ucHome = new UC_Home();

            ucRecurring.Dock = DockStyle.Fill;
            ucIdea.Dock = DockStyle.Fill;
            ucAlarm.Dock = DockStyle.Fill;
            ucDictionary.Dock = DockStyle.Fill;
            ucFavorite.Dock = DockStyle.Fill;
            ucSticky.Dock = DockStyle.Fill;
            ucOthers.Dock = DockStyle.Fill;
            //ucAccount.Dock = DockStyle.Fill;
            ucHome.Dock = DockStyle.Fill;

            //tsbtnAccount_Click(sender, e);
            tsbtnAlarm_Click(sender, e);
            tsbtnDictionary_Click(sender, e);
            tsbtnFavorite_Click(sender, e);
            tsbtnIdea_Click(sender, e);
            tsbtnOthers_Click(sender, e);
            tsbtnRecurring_Click(sender, e);
            tsbtnSchedule_Click(sender, e);
            tsbtnSticky_Click(sender, e);
            tsbtnToday_Click(sender, e);

            Calendar frmCalendar = new Calendar();
            frmCalendar.Show();
        }
Exemplo n.º 4
0
        private void tsbtnRecurring_Click(object sender, EventArgs e)
        {
            tscboSearch.Items.Clear();
            tscboSearch.Items.Add("Search by Name");
            tscboSearch.Items.Add("Search by Date");
            tscboSearch.Items.Add("Search by Time");

            iSearch = 0;

            ucRecurring = new UC_Recurring();
            flagRefresh = 1;

            if (panelContent.Controls.Count > 1)
            {
                panelContent.Controls.RemoveAt(1);
                panelContent.Controls.Add(ucRecurring);
            }
            else
            {
                panelContent.Controls.Add(ucRecurring);
            }
            UC_Recurring.Sort();
        }