Ejemplo n.º 1
0
        private void Dock_MouseDown(object sender, MouseButtonEventArgs e) // clicked some date on the calendar
        {
            #region Changing selected element on the calendar
            DockPanel d = (DockPanel)sender;
            for (int j = 1; j < 7; j++)
            {
                for (int i = start; i < 7; i++)
                {
                    if (dock[j, i] != null)
                    {
                        dock[j, i].Background = Brushes.White;
                    }
                }
            }
            d.Background = Brushes.LightGray;
            #endregion

            #region Ovveride all label, table ect
            Label    label = (Label)d.Children[0];
            DateTime dt    = new DateTime(CurrentYear, CurrentMonth, Convert.ToInt32(label.Content));
            Date_label.Content = dt.ToShortDateString();

            DataWorking.GetData(out list_note, "data.xml");
            TableWorking.FillTable(Date_label, list_note, dataGrid);
            #endregion

            #region Loading diary
            try
            {
                Diary.Load(richTextBox, Date_label);
            }
            catch (Exception ex) { richTextBox.Document.Blocks.Clear(); }
            #endregion
        }
Ejemplo n.º 2
0
        }// добавляем заметку

        public static void Delete(List <Note> list_note, Label label2, DataGrid dataGridView1, Note Selected_Note)
        {
            Note     note = new Note();
            DateTime dt;

            DateTime.TryParse(Selected_Note.date.ToString(), out dt);
            note.date = dt;
            note.text = Selected_Note.text;
            DataWorking.GetData(out list_note, "data.xml");
            list_note.Remove(note);                      // удаляем из списка
            File.WriteAllText("data.xml", string.Empty); // очищаем файл
            DataWorking.WriteData(list_note, "data.xml");
            TableWorking.FillTable(label2, list_note, dataGridView1);
        }    //удаляем заметку
Ejemplo n.º 3
0
 public static void Add(List <Note> list_note, Label label2, TextBox textBox1, TextBox textBox2, DataGrid dataGrid, CheckBox checkBox1, ComboBox comboBox1)
 {
     try
     {
         Note     note = new Note();
         DateTime dt;
         DateTime.TryParse(label2.Content + " " + textBox1.Text, out dt);
         note.date   = dt;
         note.text   = textBox2.Text;
         note.state  = comboBox1.Text;
         note.login  = AuthorizationWindow.user.name;
         note.notify = (bool)checkBox1.IsChecked;
         DataWorking.GetData(out list_note, "data.xml");
         list_note.Add(note);//добавляет в список
         DataWorking.WriteData(list_note, "data.xml");
         TableWorking.RefreshTable(label2, list_note, dataGrid);
     }
     catch (Exception ex) { MessageBox.Show(ex.Message); }
 }// добавляем заметку
Ejemplo n.º 4
0
        private void toolStripMenuItem1_Click(object sender, EventArgs e)
        {
            DataWorking.GetData(out list_note, "data.xml");
            this.Show();
            Note     note = new Note();
            DateTime dt   = note.date;

            DateTime.TryParse(DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":00", out dt);
            note.date   = dt;
            note.text   = message;
            note.notify = true;
            note.state  = "В процессе";
            note.login  = AuthorizationWindow.user.name;
            list_note.Remove(note);// удаляем из списка
            note.state  = "Завершено";
            note.notify = false;
            list_note.Add(note);
            File.WriteAllText("data.xml", string.Empty);// очищаем файл
            DataWorking.WriteData(list_note, "data.xml");
            TableWorking.RefreshTable(Date_label, list_note, dataGrid);
        }
Ejemplo n.º 5
0
 private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
 {
     TableWorking.time(backgroundWorker1, list_note);
 }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
0
 public static void RefreshTable(Label label2, List <Note> list_note, DataGrid dataGridView1)
 {
     DataWorking.GetData(out list_note, "data.xml");
     TableWorking.FillTable(label2, list_note, dataGridView1);
 }//перезагрузить таблицу