Пример #1
0
        public DailyLogger()
        {
            InitializeComponent();

            var viewModel = JsonConvert.DeserializeObject <DailyLoggerViewModels>(DailyLoggerSetting.Default.DailyLoggerViewModels);

            if (viewModel != null)
            {
                DailyLoggerViewModels = viewModel;
            }
            else
            {
                DailyLoggerViewModels = new DailyLoggerViewModels();
                DailyLoggerSetting.Default.DailyLoggerViewModels = JsonConvert.SerializeObject(DailyLoggerViewModels);
                DailyLoggerSetting.Default.Save();
            }

            Timer = new Timer
            {
                Interval = DailyLoggerViewModels.AppSettingModels.AutoSaveTime * 60 * 1000,
                Enabled  = true
            };
            Timer.Tick += Timer_Tick;

            this.txtLogger.Font = DailyLoggerViewModels.AppSettingModels.Font;
            this.TopMost        = DailyLoggerViewModels.AppSettingModels.AlwaysOnTop;

            SearchingForm        = new SearchingForm();
            AboutForm            = new AboutForm();
            HelpForm             = new HelpForm();
            NofiyIconContextMenu = new ContextMenu();
            NofiyIconContextMenu.MenuItems.Add("Show", NotifyShowEvent);
            NofiyIconContextMenu.MenuItems.Add("Quit DailyLogger", NotifyQuitEvent);
            DLoggerNotifyIcon.ContextMenu = NofiyIconContextMenu;
        }
Пример #2
0
        private void SettingEnvirement_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();

            if (folderBrowserDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            DailyLoggerViewModels.UpdateSetting(folderBrowserDialog.SelectedPath);
            listHistories.Items.Add($"Update log folder: {folderBrowserDialog.SelectedPath}");
        }
Пример #3
0
        private void SettingFont_Click(object sender, EventArgs e)
        {
            FontDialog fontDialog = new FontDialog();

            if (fontDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            DailyLoggerViewModels.UpdateSetting(fontDialog.Font);
            listHistories.Items.Add($"Update font: {fontDialog.Font.ToString()}");
            txtLogger.Font = fontDialog.Font;
        }
Пример #4
0
 private void OnTopMode()
 {
     this.TopMost = DailyLoggerViewModels.AppSettingModels.AlwaysOnTop = topMostToolStripMenuItem.Checked;
     DailyLoggerViewModels.SaveSetting();
 }
Пример #5
0
 private void AutoSaveMode()
 {
     DailyLoggerViewModels.AppSettingModels.AutoSave = SettingAutoSave.Checked;
     DailyLoggerViewModels.SaveSetting();
 }
Пример #6
0
        private void CheckKeyData(Keys keyData)
        {
            if (keyData == (DailyLoggerViewModels.AppSettingModels.ShotKeysSettingModels.OpenCurrentLogFolder[0]    // Open log folder
                            | DailyLoggerViewModels.AppSettingModels.ShotKeysSettingModels.OpenCurrentLogFolder[1]
                            | DailyLoggerViewModels.AppSettingModels.ShotKeysSettingModels.OpenCurrentLogFolder[2]))
            {
                try
                {
                    System.Diagnostics.Process.Start(DLogger.LoggerDirectory);
                }
                catch { }
            }
            else
            if (keyData == (DailyLoggerViewModels.AppSettingModels.ShotKeysSettingModels.ShowHideForm[0]    // show hide window
                            | DailyLoggerViewModels.AppSettingModels.ShotKeysSettingModels.ShowHideForm[1]
                            | DailyLoggerViewModels.AppSettingModels.ShotKeysSettingModels.ShowHideForm[2]))
            {
                ShowHideWindow();
            }
            else
            if (keyData == (DailyLoggerViewModels.AppSettingModels.ShotKeysSettingModels.ShowHideNewCommit[0]
                            | DailyLoggerViewModels.AppSettingModels.ShotKeysSettingModels.ShowHideNewCommit[1]
                            | DailyLoggerViewModels.AppSettingModels.ShotKeysSettingModels.ShowHideNewCommit[2]))
            {
            }
            else
            if (keyData == (DailyLoggerViewModels.AppSettingModels.ShotKeysSettingModels.LogCommit[0]       // Commit
                            | DailyLoggerViewModels.AppSettingModels.ShotKeysSettingModels.LogCommit[1]
                            | DailyLoggerViewModels.AppSettingModels.ShotKeysSettingModels.LogCommit[2]))
            {
                DailyLoggerCommit();
            }
            else
            if (keyData == (DailyLoggerViewModels.AppSettingModels.ShotKeysSettingModels.ShowLogFile[0]     // Open log file
                            | DailyLoggerViewModels.AppSettingModels.ShotKeysSettingModels.ShowLogFile[1]
                            | DailyLoggerViewModels.AppSettingModels.ShotKeysSettingModels.ShowLogFile[2]))
            {
                try
                {
                    System.Diagnostics.Process.Start(DLogger.TodayLoggerFile);
                }
                catch { }
            }
            else
            if (keyData == (DailyLoggerViewModels.AppSettingModels.ShotKeysSettingModels.AlwaysOnTop[0]     // Set on top mode
                            | DailyLoggerViewModels.AppSettingModels.ShotKeysSettingModels.AlwaysOnTop[1]
                            | DailyLoggerViewModels.AppSettingModels.ShotKeysSettingModels.AlwaysOnTop[2]))
            {
                DailyLoggerViewModels.AppSettingModels.AlwaysOnTop = !DailyLoggerViewModels.AppSettingModels.AlwaysOnTop;
                this.TopMost = topMostToolStripMenuItem.Checked = DailyLoggerViewModels.AppSettingModels.AlwaysOnTop;
                DailyLoggerViewModels.SaveSetting();
            }
            else
            if (keyData == (DailyLoggerViewModels.AppSettingModels.ShotKeysSettingModels.Searching[0]     // Set searching
                            | DailyLoggerViewModels.AppSettingModels.ShotKeysSettingModels.Searching[1]))
            {
                Searching();
            }
            else
            if (keyData == (DailyLoggerViewModels.AppSettingModels.ShotKeysSettingModels.AutoSave[0]     // Set Auto save mode
                            | DailyLoggerViewModels.AppSettingModels.ShotKeysSettingModels.AutoSave[1]
                            | DailyLoggerViewModels.AppSettingModels.ShotKeysSettingModels.AutoSave[2]))

            {
                DailyLoggerViewModels.AppSettingModels.AutoSave = !DailyLoggerViewModels.AppSettingModels.AutoSave;
                SettingAutoSave.Checked = DailyLoggerViewModels.AppSettingModels.AutoSave;
                DailyLoggerViewModels.SaveSetting();
            }
            else
            if (keyData == (DailyLoggerViewModels.AppSettingModels.ShotKeysSettingModels.FullScreen[0]     // Set Full screen mode
                            | DailyLoggerViewModels.AppSettingModels.ShotKeysSettingModels.FullScreen[1]
                            | DailyLoggerViewModels.AppSettingModels.ShotKeysSettingModels.FullScreen[2]))

            {
                FullScreenMode.Checked = !FullScreenMode.Checked;
                if (FullScreenMode.Checked)
                {
                    this.WindowState = FormWindowState.Maximized;
                }
                else
                {
                    this.WindowState = FormWindowState.Normal;
                }
            }
        }