Example #1
0
 public MainForm_admin(string s1, string s2)
 {
     PLogin = s1;
     PPass = s2;
     InitializeComponent();
     DelTime = new DelegateForTime(StartTime);
 }
Example #2
0
 public MainForm_oper(string str1, string str2)
 {
     PLogin = str1;
     PPass = str2;
     InitializeComponent();
     DelTime = new DelegateForTime(StartTime);
 }
Example #3
0
 public Form1()
 {
     InitializeComponent();
     DelTime = new DelegateForTime(StartTime);// указываем метод делегату
     comboBox1.Items.Add("Клиенты");
     comboBox1.Items.Add("Телефоны");
     comboBox1.Items.Add("Сотрудники");
     comboBox1.Items.Add("Заказы");
 }
Example #4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var bc = new BrushConverter();

            if (StartButton.Content.ToString() == "Старт")
            {
                _startDateTime = DateTime.Now;
                _delegateTime  = CalculateTime;

                _timeThread = new Thread(SetLabelTime)
                {
                    IsBackground = true,
                    Priority     = ThreadPriority.Lowest
                };
                _timeThread.Start();

                StartButton.Content    = "Стоп";
                StartButton.Background = (Brush)bc.ConvertFrom("#FFF97171");

                ProjectListBox.IsEnabled = false;
                TaskbarItemInfo.Overlay  = (ImageSource)Resources["OverlayImage"];
            }
            else
            {
                _endDateTime = DateTime.Now;
                _timeThread.Abort();
                StartButton.Content    = "Старт";
                StartButton.Background = (Brush)bc.ConvertFrom("#FF63B85F");

                TimeLabel.Content = "0 ч. 0 м.";

                var ti = new TimeInterval();
                ti.StartDate = _startDateTime.ToString();
                ti.EndDate   = _endDateTime.ToString();

                TimeManagement.Projects[_indexSelectProject].TimeIntervals.Add(ti);

                RebuildTimeInfo();

                ProjectListBox.IsEnabled = true;
                TaskbarItemInfo.Overlay  = null;
                _startDateTime           = null;
            }
        }
Example #5
0
 public Form1()
 {
     InitializeComponent();
     DelTime = new DelegateForTime(StartTime);// указываем метод делегату
 }
Example #6
0
        public Form1()
        {
            InitializeComponent();

            #region HotKeys Initialization
            hks = new HotKeys[6];
            for (int j = 0; j < 6; j++)
            {
                hks[j] = new HotKeys();
            }

            hks[0].Key            = Keys.F3;
            hks[0].HotKeyPressed += viewFile; // просмотр файла исспользуя NotePad

            hks[1].Key            = Keys.F4;
            hks[1].HotKeyPressed += editFile; // редактирование файла исспользуя NotePad

            hks[2].Key = Keys.F5;
            //hks[2].HotKeyPressed += copyFileOrDir; // копирование Файла/Папки
            hks[2].HotKeyPressed += CopyBtn_Click;

            hks[3].Key            = Keys.F6;
            hks[3].HotKeyPressed += moveFile; // перемещение Файла/Папки

            hks[4].Key            = Keys.F7;
            hks[4].HotKeyPressed += createDir; // создание каталога

            hks[5].Key            = Keys.F8;
            hks[5].HotKeyPressed += deleteFileOrDir; // удаление Файла/Папки(включая подкаталоги)
            #endregion

            #region mainSplitContainer
            this.Text          = "File Manager";
            this.Size          = new Size(840, 500);
            this.StartPosition = FormStartPosition.CenterScreen;

            mainSplitContainer = new SplitContainer();
            Controls.Add(mainSplitContainer);
            mainSplitContainer.Dock             = DockStyle.Fill;
            mainSplitContainer.SplitterDistance = 420; // расстояние слева от разделителя

            #endregion

            #region Left
            LeftListView               = new ListView();
            LeftListView.Dock          = DockStyle.Fill;
            LeftListView.FullRowSelect = true;
            LeftListView.GridLines     = true;
            LeftListView.MultiSelect   = false;
            LeftListView.View          = View.Details;
            LeftListView.Columns.Add("Название", 250);
            LeftListView.Columns.Add("Тип", 50);
            LeftListView.Columns.Add("Размер", 100);
            mainSplitContainer.Panel1.Controls.Add(LeftListView);

            LeftTopPanel = new Panel();
            mainSplitContainer.Panel1.Controls.Add(LeftTopPanel);
            LeftTopPanel.Dock    = DockStyle.Top;
            LeftTopPanel.Padding = new Padding(0, 5, 17, 0);
            LeftTopPanel.Size    = new Size(0, 28);

            btnLeftPathPanel         = new Panel();
            btnLeftPathPanel.Dock    = DockStyle.Bottom;
            btnLeftPathPanel.Size    = new Size(0, 22);
            btnLeftPathPanel.Padding = new Padding(5, 5, 0, 0);
            mainSplitContainer.Panel1.Controls.Add(btnLeftPathPanel);

            LeftPath      = new Label();
            LeftPath.Dock = DockStyle.Left;
            btnLeftPathPanel.Controls.Add(LeftPath);

            btnLeftPanel      = new Panel();
            btnLeftPanel.Dock = DockStyle.Left;
            LeftTopPanel.Controls.Add(btnLeftPanel);

            LeftDisk        = new ComboBox();
            LeftDisk.Dock   = DockStyle.Right;
            LeftDisk.Margin = new Padding(10);
            LeftDisk.Size   = new Size(89, 21);
            LeftTopPanel.Controls.Add(LeftDisk);
            #endregion

            #region Right
            RightListView               = new ListView();
            RightListView.Dock          = DockStyle.Fill;
            RightListView.FullRowSelect = true;
            RightListView.GridLines     = true;
            RightListView.MultiSelect   = false;
            RightListView.View          = View.Details;
            RightListView.Columns.Add("Название", 250);
            RightListView.Columns.Add("Тип", 50);
            RightListView.Columns.Add("Размер", 100);
            mainSplitContainer.Panel2.Controls.Add(RightListView);

            RightTopPanel = new Panel();
            mainSplitContainer.Panel2.Controls.Add(RightTopPanel);
            RightTopPanel.Dock    = DockStyle.Top;
            RightTopPanel.Padding = new Padding(0, 5, 17, 0);
            RightTopPanel.Size    = new Size(0, 28);

            btnRightPathPanel         = new Panel();
            btnRightPathPanel.Dock    = DockStyle.Bottom;
            btnRightPathPanel.Size    = new Size(0, 22);
            btnRightPathPanel.Padding = new Padding(5, 5, 0, 0);
            mainSplitContainer.Panel2.Controls.Add(btnRightPathPanel);

            RightPath      = new Label();
            RightPath.Dock = DockStyle.Left;
            btnRightPathPanel.Controls.Add(RightPath);

            btnRightPanel      = new Panel();
            btnRightPanel.Dock = DockStyle.Left;
            RightTopPanel.Controls.Add(btnRightPanel);

            RightDisk        = new ComboBox();
            RightDisk.Dock   = DockStyle.Right;
            RightDisk.Margin = new Padding(10);
            RightDisk.Size   = new Size(89, 21);
            RightTopPanel.Controls.Add(RightDisk);
            #endregion

            #region Panel for Functional Buttons
            ButtonPanel           = new Panel();
            ButtonPanel.BackColor = Color.Azure;
            Controls.Add(ButtonPanel);
            ButtonPanel.Dock = DockStyle.Bottom;
            ButtonPanel.Size = new Size(100, 30);
            #endregion

            #region Buttons : EditBtn, ViewBtn, MkDirBtn, DelBtn, MovBtn, CopyBtn;
            EditBtn          = new Button();
            EditBtn.Size     = new Size(85, 23);
            EditBtn.Location = new Point(88, 3);
            EditBtn.Text     = "F4 Правка";
            ButtonPanel.Controls.Add(EditBtn);

            ViewBtn          = new Button();
            ViewBtn.Size     = new Size(85, 23);
            ViewBtn.Location = new Point(2, 3);
            ViewBtn.Text     = "F3 Просмотр";
            ButtonPanel.Controls.Add(ViewBtn);

            MkDirBtn          = new Button();
            MkDirBtn.Size     = new Size(85, 23);
            MkDirBtn.Location = new Point(368, 3);
            MkDirBtn.Text     = "F7 Каталог";
            ButtonPanel.Controls.Add(MkDirBtn);

            DelBtn          = new Button();
            DelBtn.Size     = new Size(85, 23);
            DelBtn.Location = new Point(454, 3);
            DelBtn.Text     = "F8 Удаление";
            ButtonPanel.Controls.Add(DelBtn);

            MovBtn          = new Button();
            MovBtn.Size     = new Size(105, 23);
            MovBtn.Location = new Point(263, 3);
            MovBtn.Text     = "F6 Перемещение";
            ButtonPanel.Controls.Add(MovBtn);

            CopyBtn          = new Button();
            CopyBtn.Size     = new Size(90, 23);
            CopyBtn.Location = new Point(173, 3);
            CopyBtn.Text     = "F5 Копировать";
            ButtonPanel.Controls.Add(CopyBtn);
            #endregion

            #region ProgressBar
            actionProgressBar          = new ProgressBar();
            actionProgressBar.Location = new Point(454 + 85 + 4, 3);
            actionProgressBar.Size     = new Size(175, 24);
            ButtonPanel.Controls.Add(actionProgressBar);
            actionProgressBar.Visible = false;
            #endregion

            #region ToolStripMenuItem
            ToolStripMenuItem Menu = new ToolStripMenuItem()
            {
                Text = "Дополнительные команды"
            };
            Menu.DropDownItems.AddRange
            (
                new ToolStripItem[]
            {
                new ToolStripMenuItem()
                {
                    Text = "Создать txt-файл", ShortcutKeys = Keys.Alt | Keys.N, ShowShortcutKeys = true
                },
                new ToolStripSeparator()
                {
                },
                new ToolStripMenuItem()
                {
                    Text = "Размер папки", ShortcutKeys = Keys.Alt | Keys.S, ShowShortcutKeys = true
                },
                new ToolStripMenuItem()
                {
                    Text = "Поиск файлов", ShortcutKeys = Keys.Alt | Keys.F7, ShowShortcutKeys = true
                },
                new ToolStripSeparator()
                {
                },
                new ToolStripMenuItem()
                {
                    Text = "Выход", ShortcutKeys = Keys.Alt | Keys.F4, ShowShortcutKeys = true
                }
            }
            );

            ToolStripMenuItem helpMenuRu = new ToolStripMenuItem()
            {
                Text = "Справка"
            };
            helpMenuRu.DropDownItems.AddRange
            (
                new ToolStripItem[]
            {
                new ToolStripMenuItem()
                {
                    Text = "О программе ...", ShortcutKeys = Keys.F1, ShowShortcutKeys = true
                }
            }
            );

            menuRU = new MenuStrip()
            {
                Location = new Point(0, 0),
                Size     = new Size(292, 24),
                Visible  = true
            };

            menuRU.Items.AddRange(
                new ToolStripItem[] { Menu, helpMenuRu, }
                );

            Controls.Add(menuRU);
            #endregion

            #region Buttons Of Driver load in ComboBox
            int      i       = 0;
            string[] drivers = Directory.GetLogicalDrives();
            foreach (string drive in drivers)
            {
                LeftDisk.Items.Add(drive);
                RightDisk.Items.Add(drive);

                try
                {
                    LeftDiscDriverBtn.Add(new Button());
                    LeftDiscDriverBtn.Last().Location = new Point(2 + i * 32, 0);
                    LeftDiscDriverBtn.Last().Size     = new Size(32, 22);
                    LeftDiscDriverBtn.Last().Text     = drive.ToString();
                    LeftDiscDriverBtn.Last().Click   += LeftDiscDriver_Click;
                    this.btnLeftPanel.Controls.Add(this.LeftDiscDriverBtn.Last());

                    RightDiscDriverBtn.Add(new Button());
                    RightDiscDriverBtn.Last().Location = new Point(2 + i * 32, 0);
                    RightDiscDriverBtn.Last().Size     = new Size(32, 22);
                    RightDiscDriverBtn.Last().Text     = drive.ToString();
                    RightDiscDriverBtn.Last().Click   += RightDiscDriver_Click;
                    this.btnRightPanel.Controls.Add(this.RightDiscDriverBtn.Last());

                    i++;
                }
                catch { }
            }
            LeftDisk.SelectedIndex  = 0;
            RightDisk.SelectedIndex = drivers.Length - 1;
            #endregion

            #region Events
            RightDisk.SelectedIndexChanged += RightDisk_SelectedIndexChanged;
            LeftDisk.SelectedIndexChanged  += LeftDisk_SelectedIndexChanged;

            LeftListView.Click        += LeftListView_Click;
            RightListView.Click       += RightListView_Click;
            LeftListView.DoubleClick  += ListView_DoubleClick;
            RightListView.DoubleClick += ListView_DoubleClick;

            Menu.DropDownItems[3].Click += findFile;
            Menu.DropDownItems[2].Click += calcSizeDir;

            MkDirBtn.Click += createDir;
            MovBtn.Click   += moveFile;
            ViewBtn.Click  += viewFile;
            EditBtn.Click  += editFile;
            CopyBtn.Click  += CopyBtn_Click;
            DelBtn.Click   += deleteFileOrDir;


            #endregion

            #region for The Time
            DelClock = new DelegateForTime(StartTime);
            // указываем метод делегату
            clockLb           = new Label();
            clockLb.Dock      = DockStyle.Right;
            clockLb.Size      = new Size(100, 20);
            clockLb.Font      = new Font("Time New Roman", 11, FontStyle.Italic);
            clockLb.TextAlign = ContentAlignment.MiddleCenter;
            clockLb.BackColor = Color.LightBlue;

            ButtonPanel.Controls.Add(clockLb);
            this.Load += Form1_Load;
            #endregion

            #region Worker
            aWorker = new BackgroundWorker();
            aWorker.WorkerReportsProgress = true;
            aWorker.RunWorkerCompleted   += AWorker_RunWorkerCompleted;
            //aWorker.DoWork += copyFileOrDir;
            aWorker.DoWork          += AWorker_DoWork;
            aWorker.ProgressChanged += AWorker_ProgressChanged;
            #endregion
        }
Example #7
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var bc = new BrushConverter();
            if (StartButton.Content.ToString() == "Старт")
            {
                _startDateTime = DateTime.Now;
                _delegateTime = CalculateTime;

                _timeThread = new Thread(SetLabelTime)
                {
                    IsBackground = true,
                    Priority = ThreadPriority.Lowest
                };
                _timeThread.Start();

                StartButton.Content = "Стоп";
                StartButton.Background = (Brush) bc.ConvertFrom("#FFF97171");

                ProjectListBox.IsEnabled = false;
                TaskbarItemInfo.Overlay = (ImageSource) Resources["OverlayImage"];
            }
            else
            {
                _endDateTime = DateTime.Now;
                _timeThread.Abort();
                StartButton.Content = "Старт";
                StartButton.Background = (Brush) bc.ConvertFrom("#FF63B85F");

                TimeLabel.Content = "0 ч. 0 м.";

                var ti = new TimeInterval();
                ti.StartDate = _startDateTime.ToString();
                ti.EndDate = _endDateTime.ToString();

                TimeManagement.Projects[_indexSelectProject].TimeIntervals.Add(ti);

                RebuildTimeInfo();

                ProjectListBox.IsEnabled = true;
                TaskbarItemInfo.Overlay = null;
                _startDateTime = null;
            }
        }
Example #8
0
 public Form1()
 {
     InitializeComponent(); DelTime = new DelegateForTime(StartTime); // указываем метод делегату
 }