コード例 #1
0
ファイル: Form1.cs プロジェクト: thepunkduck/CodeWatcher
        public Form1()
        {
            InitializeComponent();



#if DEBUG == true
            for (int i = 0; i < 16; i++)
            {
                ActionTypes at_A = (ActionTypes)i;
                string      s1   = "";
                string      s2   = "";
                string      s3   = "";
                s1 += (at_A.BinaryString(4) + "  :  ");
                s2 += ("ANY   :  ");
                s3 += ("HAS   :  ");
                for (int j = 0; j < 16; j++)
                {
                    ActionTypes at_B = (ActionTypes)j;
                    s1 += (at_B.BinaryString(4) + "  ");
                    s2 += (at_A.HasAny(at_B) ? "TRUE  " : "FALSE ");
                    s3 += (at_A.HasFlag(at_B) ? "TRUE  " : "FALSE ");
                }

                Console.WriteLine(s1);
                Console.WriteLine(s2);
                Console.WriteLine(s3);
                Console.WriteLine();
            }
#endif

            notifyIcon1.BalloonTipClosed += (sender, e) =>
            {
                var thisIcon = (NotifyIcon)sender;
                thisIcon.Visible = false;
                thisIcon.Dispose();
            };

            // watch this file structure
            _fcWatcher = new FileChangeWatcher {
                Extensions = new[] { ".cs" }
            };
            _fcWatcher.Changed += FolderChangeWatcher_Changed;
            _fcWatcher.Error   += FolderChangeWatcher_Error;

            eventScroller1.FileChangeWatcher = _fcWatcher;

            _themeController          = new ThemeController();
            _themeController.Changed += Themer_Changed;

            _mainPanel = new MainPanel(_fcWatcher, doubleBuffer1, _themeController.Theme);

            this.Icon = notifyIcon1.Icon;
            BaseForm.ApplicationIcon = notifyIcon1.Icon;

            toolStripTextBoxWithLabelIdleTime.LabelText    = "Idle Time(m)";
            toolStripTextBoxWithLabelTimePerEdit.LabelText = "Per Edit Time(m)";
            toolStripTextBoxWithLabelIdleTime.Set(_fcWatcher.UserIdleMinutes);
            toolStripTextBoxWithLabelTimePerEdit.Set(_fcWatcher.PerEditMinutes);
            toolStripTextBoxWithLabelIdleTime.TextBox.EnterPressed    += TextBox_EnterPressed;
            toolStripTextBoxWithLabelTimePerEdit.TextBox.EnterPressed += TextBox_EnterPressed1;
            useIdleEventsToolStripMenuItem.Checked    = _fcWatcher.UseIdleEvents;
            advancedToolStripMenuItem.DropDownClosed += AdvancedToolStripMenuItem_DropDownClosed;

            foreach (var eSrt in Enum.GetValues(typeof(EditSort)))
            {
                ToolStripRadioButtonMenuItem rb = new ToolStripRadioButtonMenuItem(eSrt.ToString());
                rb.Tag = eSrt;
                dayInfoSortToolStripMenuItem.DropDownItems.Add(rb);
                rb.CheckedChanged += Rb_CheckedChanged;
            }

            Application.Idle += Application_Idle;
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: thepunkduck/CodeWatcher
        public Form1()
        {
            InitializeComponent();



#if DEBUG == true
            for (int i = 0; i < 16; i++)
            {
                ActionTypes at_A = (ActionTypes)i;
                string      s1   = "";
                string      s2   = "";
                string      s3   = "";
                s1 += (at_A.BinaryString(4) + "  :  ");
                s2 += ("ANY   :  ");
                s3 += ("HAS   :  ");
                for (int j = 0; j < 16; j++)
                {
                    ActionTypes at_B = (ActionTypes)j;
                    s1 += (at_B.BinaryString(4) + "  ");
                    s2 += (at_A.HasAny(at_B) ? "TRUE  " : "FALSE ");
                    s3 += (at_A.HasFlag(at_B) ? "TRUE  " : "FALSE ");
                }

                Console.WriteLine(s1);
                Console.WriteLine(s2);
                Console.WriteLine(s3);
                Console.WriteLine();
            }

            TimeBox.TestSubtract();
#endif

            notifyIcon1.BalloonTipClosed += (sender, e) =>
            {
                var thisIcon = (NotifyIcon)sender;
                thisIcon.Visible = false;
                thisIcon.Dispose();
            };

            // watch this file structure
            _fcWatcher            = new FileChangeWatcher();
            _fcWatcher.Extensions = new string[] { ".cs" };
            _fcWatcher.Changed   += FolderChangeWatcher_Changed;
            _fcWatcher.Error     += FolderChangeWatcher_Error;
            //_fcWatcher.AutoSaveMinutesInterval = 3;

            eventScroller1.FileChangeWatcher = _fcWatcher;

            themeController          = new ThemeController();
            themeController.Changed += Themer_Changed;

            mainPanel = new MainPanel(_fcWatcher, doubleBuffer1, themeController.Theme);

            this.Icon = notifyIcon1.Icon;
            BaseForm.ApplicationIcon = notifyIcon1.Icon;

            toolStripTextBoxWithLabelIdleTime.LabelText    = "Idle Time(m)";
            toolStripTextBoxWithLabelTimePerEdit.LabelText = "Per Edit Time(m)";
            toolStripTextBoxWithLabelIdleTime.Set(_fcWatcher.UserIdleMinutes);
            toolStripTextBoxWithLabelTimePerEdit.Set(_fcWatcher.PerEditMinutes);
            toolStripTextBoxWithLabelIdleTime.TextBox.EnterPressed    += TextBox_EnterPressed;
            toolStripTextBoxWithLabelTimePerEdit.TextBox.EnterPressed += TextBox_EnterPressed1;
            useIdleEventsToolStripMenuItem.Checked    = _fcWatcher.UseIdleEvents;
            advancedToolStripMenuItem.DropDownClosed += AdvancedToolStripMenuItem_DropDownClosed;
            Application.Idle += Application_Idle;
        }