WriteLog() public method

public WriteLog ( Color c, string text ) : void
c Color
text string
return void
Ejemplo n.º 1
0
        void OnProcessExit(ProcessModel model)
        {
            RefreshButtonStatus();

            tabMain.Refresh();

            model.WriteLog(Color.Yellow, string.Format("进程结束({0})", model.ExitCode));
        }
Ejemplo n.º 2
0
        void OnProcessStart(ProcessModel model)
        {
            model.WriteLog(Color.Yellow, "进程启动 ");

            RefreshButtonStatus();

            tabMain.Refresh();
        }
Ejemplo n.º 3
0
        void OnProcessStart(ProcessModel model )
        {
            model.WriteLog(Color.Yellow, "进程启动 ");

            RefreshButtonStatus();

            tabMain.Refresh();
        }
Ejemplo n.º 4
0
        void OnProcessExit(ProcessModel model)
        {
            RefreshButtonStatus();

            tabMain.Refresh();

            model.WriteLog(Color.Yellow, string.Format("进程结束({0})", model.ExitCode) );
        }
Ejemplo n.º 5
0
        object OnProcessCreate(ProcessModel model)
        {
            var name = Path.GetFileNameWithoutExtension(model.FileName);

            var page = new TabPage(name);
            page.ContextMenuStrip = logMenu;
            var logview = new LogView();
            page.ToolTipText = model.FileName;

            page.Controls.Add(logview);
            tabMain.TabPages.Add(page);

            model.Index = tabMain.TabPages.IndexOf(page);

            tabMain.SelectedTab = page;
            tabMain.MouseClick += (sender, e) =>
            {
                if ( e.Button == System.Windows.Forms.MouseButtons.Right )
                {
                    tabMenu.Show(tabMain, e.Location);
                }
            };

            Action<ProcessModel, Color, string> logProc = (m, c, data) =>
            {
                logview.AddLog(c, data, model.AutoScroll);
            };

            model.OnStart += OnProcessStart;
            model.OnStop += OnProcessStop;
            model.OnExit += OnProcessExit;

            model.OnLog += logProc;
            model.OnError += logProc;
            model.view = logview;

            model.OnClear += delegate()
            {
                logview.Items.Clear();
            };

            model.OnGetData += ( index ) =>
            {
                return logview.Items[index] as LogData;
            };

            model.OnGetDataCount += ( ) =>
            {
                return logview.Items.Count;
            };

            model.OnGetAllLog += delegate()
            {
                return logview.AllLogToString();
            };

            model.OnGetSelectedContent += delegate()
            {
                var logdata = logview.SelectedItem as LogData;
                if (logdata == null)
                    return string.Empty;

                return logdata.Text;
            };

            model.WriteLog(Color.Yellow, "就绪");

            return page;
        }
Ejemplo n.º 6
0
        object OnProcessCreate(ProcessModel model)
        {
            var name = Path.GetFileNameWithoutExtension(model.FileName);

            var page = new TabPage(name);

            page.ContextMenuStrip = logMenu;
            var logview = new LogView();

            page.ToolTipText = model.FileName;

            page.Controls.Add(logview);
            tabMain.TabPages.Add(page);

            model.Index = tabMain.TabPages.IndexOf(page);

            tabMain.SelectedTab = page;
            tabMain.MouseClick += (sender, e) =>
            {
                if (e.Button == System.Windows.Forms.MouseButtons.Right)
                {
                    tabMenu.Show(tabMain, e.Location);
                }
            };

            Action <ProcessModel, Color, string> logProc = (m, c, data) =>
            {
                logview.AddLog(c, data, model.AutoScroll);
            };

            model.OnStart += OnProcessStart;
            model.OnStop  += OnProcessStop;
            model.OnExit  += OnProcessExit;

            model.OnLog   += logProc;
            model.OnError += logProc;
            model.view     = logview;

            model.OnClear += delegate()
            {
                logview.Items.Clear();
            };

            model.OnGetData += (index) =>
            {
                return(logview.Items[index] as LogData);
            };


            model.OnGetDataCount += () =>
            {
                return(logview.Items.Count);
            };

            model.OnGetAllLog += delegate()
            {
                return(logview.AllLogToString());
            };

            model.OnGetSelectedContent += delegate()
            {
                var logdata = logview.SelectedItem as LogData;
                if (logdata == null)
                {
                    return(string.Empty);
                }

                return(logdata.Text);
            };

            model.WriteLog(Color.Yellow, "就绪");

            return(page);
        }