Esempio n. 1
0
 private void Button_Click_3(object sender, RoutedEventArgs e)
 {
     Diary.Save(richTextBox, Date_label);
 }
Esempio n. 2
0
        public MainWindow()
        {
            InitializeComponent();

            #region Calendar initialization
            FillCalendar(CurrentYear, CurrentMonth);
            ShowDayNames(Mo, Tu, We, Th, Fr, Sa, Su);
            ShowMonthNamesAndCurrentYear(CurrentMonth, CurrentYear, label3);

            int a = (DateTime.Now.Day + start2) % 8;
            int b = (DateTime.Now.Day + start2) / 8 + 1;
            dock[b, a].Background = Brushes.LightGray;
            #endregion

            #region Task tab's item initialization
            Date_label.Content = DateTime.Now.ToShortDateString();
            DataWorking.GetData(out list_note, "data.xml");
            for (int i = 0; i < list_note.Count; i++)
            {
                if ((list_note[i].date < DateTime.Now) && (list_note[i].state == "В процессе") && (list_note[i].login == AuthorizationWindow.user.name) && (list_note[i].notify == true))
                {
                    list_note[i].state = "Не выполнено";
                    DataWorking.WriteData(list_note, "data.xml");
                }
            }
            TableWorking.FillTable(Date_label, list_note, dataGrid);

            State_comboBox.Items.Add("В процессе");
            State_comboBox.Items.Add("Завершено");
            #endregion

            #region Diary tab's item initialization
            InstalledFontCollection     ifc      = new InstalledFontCollection();
            System.Drawing.FontFamily[] families = ifc.Families;
            for (int i = 0; i < families.Length; i++)
            {
                Label lb = new Label();
                lb.Content    = families[i].Name;
                lb.FontFamily = new FontFamily(families[i].Name);
                comboBox1.Items.Add(lb);
            }
            comboBox1.Text = "Times New Roman";

            int[] FontSizes = { 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72 };
            for (int i = 0; i < FontSizes.Length; i++)
            {
                comboBox2.Items.Add(FontSizes[i]);
            }
            comboBox2.Text = "14";

            comboBox3.ItemsSource = typeof(Colors).GetProperties();

            try
            {
                Diary.Load(richTextBox, Date_label);
            }
            catch (Exception ex) { richTextBox.Document.Blocks.Clear(); }
            #endregion

            #region NotifyIcon initialization
            System.Drawing.Icon icon = new System.Drawing.Icon(@"G:\Orinizer_WPF_Project\Orginizer\Orginizer\Images\calendar.ico");
            notifyIcon1.Icon               = icon;
            notifyIcon1.Visible            = true;
            notifyIcon1.BalloonTipClicked += new System.EventHandler(notifyIcon1_BalloonTipClicked);
            #endregion

            #region BackgroundWorker initialization
            backgroundWorker1.DoWork          += new System.ComponentModel.DoWorkEventHandler(backgroundWorker1_DoWork);
            backgroundWorker1.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(backgroundWorker1_ProgressChanged);
            backgroundWorker1.RunWorkerAsync();
            #endregion

            contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[]
            {
                toolStripMenuItem1,
                toolStripMenuItem2
            });
            contextMenuStrip1.Visible = true;
            contextMenuStrip1.Size    = new System.Drawing.Size(138, 48);

            toolStripMenuItem1.Text   = "Завершено";
            toolStripMenuItem1.Click += new System.EventHandler(toolStripMenuItem1_Click);
            contextMenuStrip1.Size    = new System.Drawing.Size(138, 48);

            toolStripMenuItem2.Text   = "Отложить";
            toolStripMenuItem2.Click += new System.EventHandler(toolStripMenuItem2_Click);
            toolStripMenuItem2.Size   = new System.Drawing.Size(137, 22);
        }