protected override void OnActivated() { base.OnActivated(); if (MainClass.Settings.ClearConsoleBeforRuning) MainClass.MainWindow.OutputConsole.Clear(); if(MainClass.Settings.SaveChangesBeforeRun){ Tool.Logger.LogDebugInfo("SAVE PAGES"); MainClass.MainWindow.EditorNotebook.SaveAllPage(); MainClass.MainWindow.SaveWorkspace(); } MainClass.MainWindow.ClearOutput(); TaskList tl = new TaskList(); tl.TasksList = new System.Collections.Generic.List<Moscrif.IDE.Task.ITask>(); RunEmulatorDebugTask ret = new RunEmulatorDebugTask(); ret.LogMonitor += new ProcessErrorHandler(MainClass.MainWindow.MonitorTaskWritte); ret.LogGarbageCollector += new ProcessErrorHandler(MainClass.MainWindow.GcTaskWritte); tl.TasksList.Add(ret); MainClass.MainWindow.RunTaskList(tl,true); return; }
public void RunPrimaryTastList(TaskList taskList, ProcessTaskHandler processTaskHandler) { isPrimary = true; //taskList.EndTaskWritte += processTaskHandler; foreach (ITask task in taskList.TasksList){ task.EndTaskWrite +=processTaskHandler; } taskList.ExecuteTask(); isPrimary = false; }
public void RunSecondaryTastList(TaskList taskList, ProcessTaskHandler processTaskHandler,ProcessErrorHandler errorTaskHandler) { if (isBussy || isPrimary) return; foreach (ITask task in taskList.TasksList){ //task.EndTaskWritte += processTaskHandler; task.ErrorWrite+=errorTaskHandler; task.EndTaskWrite +=processTaskHandler; } //secondTaskList = taskList; if(secondTaskList== null) secondTaskList = new TaskList(); secondTaskList.TasksList.AddRange(taskList.TasksList); }
protected override void OnActivated() { base.OnActivated(); if (MainClass.Settings.ClearConsoleBeforRuning) MainClass.MainWindow.OutputConsole.Clear(); if(MainClass.Settings.SaveChangesBeforeRun){ MainClass.MainWindow.EditorNotebook.SaveAllPage(); MainClass.MainWindow.SaveWorkspace(); } MainClass.MainWindow.ClearOutput(); TaskList tl = new TaskList(); tl.TasksList = new System.Collections.Generic.List<Moscrif.IDE.Task.ITask>(); RunEmulatorConsoleTask ret = new RunEmulatorConsoleTask(); tl.TasksList.Add(ret); MainClass.MainWindow.RunTaskList(tl,true); // return; /*if(MainClass.Workspace.ActualProject == null){ MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, "Error", "Please select Project", Gtk.MessageType.Error); md.ShowDialog(); return; } if (MainClass.Workspace.ClearConsoleBeforRuning) MainClass.MainWindow.OutputConsole.Clear(); string cmd = Path.Combine(MainClass.Settings.EmulatorDirectory, "moscrif.exe"); AppFile appFile = MainClass.Workspace.ActualProject.AppFile; string projDir = Path.GetDirectoryName(appFile.ApplicationFile); if (!projDir.EndsWith(Path.DirectorySeparatorChar.ToString())) projDir += Path.DirectorySeparatorChar; //string args = String.Format("/f {0} /d {1} /o console-win /w nowindow", Path.GetFileName(appFile.ApplicationFile), projDir); string args = String.Format("/f {0} /d {1} /o console /w nowindow", Path.GetFileName(appFile.ApplicationFile), projDir); //string args = String.Format("/f {0} /d {1} /o console ", Path.GetFileName(appFile.ApplicationFile), projDir); MainClass.MainWindow.RunProcess(cmd, args,MainClass.Settings.EmulatorDirectory); */ }
public void RunPrimaryTastListOnlineWrite(TaskList taskList, ProcessTaskHandler processTaskHandler,ProcessErrorHandler errorTaskHandler,ProcessErrorHandler logTaskHandler) { isPrimary = true; //taskList.EndTaskWritte += processTaskHandler; //taskList.ErrorTaskWritte+=errorTaskHandler; //if (logTaskHandler != null) // taskList.LogTaskWritte+= logTaskHandler; foreach (ITask task in taskList.TasksList){ task.ErrorWrite+=errorTaskHandler; task.EndTaskWrite +=processTaskHandler; if (logTaskHandler != null) task.LogWrite+= logTaskHandler; } taskList.ExecuteTaskOnlineWrite(); isPrimary = false; }
protected override void OnActivated() { base.OnActivated(); MainClass.MainWindow.ProcessOutput.Clear(); MainClass.MainWindow.ErrorOutput.Clear(); if (MainClass.Settings.ClearConsoleBeforRuning) MainClass.MainWindow.OutputConsole.Clear(); TaskList tl = new TaskList(); tl.TasksList = new System.Collections.Generic.List<Moscrif.IDE.Task.ITask>(); CompileTask ct = new CompileTask(); tl.TasksList.Add(ct ); MainClass.MainWindow.RunTaskList(tl,false); return; }
private void StartFindReplaceInFiles(SearchPattern sp) { MainClass.MainWindow.FindOutput.Clear(); // first - find/replace in open files List<string> notOpen = new List<string>(sp.CloseFiles); List<string> opened = new List<string>(sp.OpenFiles); List<string> allOpened = new List<string>(MainClass.MainWindow.EditorNotebook.OpenFiles); // files in not opened -vsetky subory rozdelime na otvorene a zavrete if(sp.CloseFiles.Count>0){ // Except(sp.CloseFiles,allOpened); notOpen =new List<string>(sp.CloseFiles.Except(allOpened,StringComparer.CurrentCultureIgnoreCase).ToList().ToArray()); opened = new List<string>(sp.CloseFiles.Except(notOpen,StringComparer.CurrentCultureIgnoreCase).ToList().ToArray()); sp.CloseFiles = new List<string>(notOpen); sp.OpenFiles = new List<string>(opened); } TaskList tl = new TaskList(); /*if(opened.Count>0){ SearchPattern spO = sp.Clone(); spO.OpenFiles = new List<string>(opened); FindInOpenFileTask rt = new FindInOpenFileTask(); rt.Initialize(spO); tl.TasksList.Clear(); tl.TasksList.Add(rt); sp.CloseFiles = new List<string>(notOpen); }*/ // find replace in closed files FindReplaceTask ft = new FindReplaceTask(); //ReplaceTask ft = new ReplaceTask(); ft.Initialize(sp); tl.TasksList.Add(ft); MainClass.MainWindow.RunSecondaryTaskList(tl, MainClass.MainWindow.FindOutputWritte,false); }
private void RunPublishTask(List<CombinePublish> list) { LoggingInfo log = new LoggingInfo(); log.LoggWebThread(LoggingInfo.ActionId.IDEPublish,project.ProjectName); int selectTyp = (int)ddbTypPublish.CurrentItem; if((selectTyp == 0) || (!MainClass.Workspace.SignApp)){ tlpublish = new TaskList(); tlpublish.TasksList = new System.Collections.Generic.List<Moscrif.IDE.Task.ITask>(); string selectRemote = (string)ddbTypRemote.CurrentItem; Console.WriteLine("selectRemote-"+selectRemote); if(selectRemote != "0"){ AppFile appF = MainClass.Workspace.ActualProject.AppFile; appF.Remote_Console =selectRemote+":"+MainClass.Settings.SocetServerPort; appF.Save(); Console.WriteLine("MainClass.Workspace.ActualProject.AppFile.Remote_Console-"+MainClass.Workspace.ActualProject.AppFile.Remote_Console); } else { AppFile appF = MainClass.Workspace.ActualProject.AppFile; appF.Remote_Console =""; appF.Save(); } PublishAsynchronTask pt = new PublishAsynchronTask(); pt.ParentWindow = this; pt.EndTaskWrite+= MainClass.MainWindow.EndTaskWritte; pt.EndTaskWrite+= delegate(object sender, string name, string status, List<TaskMessage> errors) { runningPublish = false; btnCancel.Label = "_Close"; if(selectRemote != "0"){ AppFile appF = MainClass.Workspace.ActualProject.AppFile; appF.Remote_Console =""; appF.Save(); } }; pt.ErrorWrite+= MainClass.MainWindow.ErrorTaskWritte; pt.LogWrite+= MainClass.MainWindow.LogTaskWritte; pt.WriteStep+= delegate(object sender, StepEventArgs e) { storeOutput.AppendValues(e.Message1,e.Message2,null,e.IsError); if(status!=1) status = e.Status; while (Gtk.Application.EventsPending ()) Gtk.Application.RunIteration (); }; pt.Initialize(list); tlpublish.TasksList.Add(pt); secondTaskThread = new Thread(new ThreadStart(tlpublish.ExecuteTaskOnlineWrite )); secondTaskThread.Name = "Publish Second Task"; secondTaskThread.IsBackground = true; runningPublish = true; btnCancel.Label = "_Cancel"; secondTaskThread.Start(); } else { tlpublish = new TaskList(); tlpublish.TasksList = new System.Collections.Generic.List<Moscrif.IDE.Task.ITask>(); SignPublishAsynchronTask pt = new SignPublishAsynchronTask(); pt.ParentWindow = this; pt.EndTaskWrite+= MainClass.MainWindow.EndTaskWritte; pt.EndTaskWrite+= delegate(object sender, string name, string status, List<TaskMessage> errors) { runningPublish = false; btnCancel.Label = "_Close"; }; pt.ErrorWrite+= MainClass.MainWindow.ErrorTaskWritte; pt.LogWrite+= MainClass.MainWindow.LogTaskWritte; pt.WriteStep+= delegate(object sender, StepEventArgs e) { storeOutput.AppendValues(e.Message1,e.Message2,null,e.IsError); if(status!=1) status = e.Status; while (Gtk.Application.EventsPending ()) Gtk.Application.RunIteration (); }; pt.Initialize(list); tlpublish.TasksList.Add(pt); secondTaskThread = new Thread(new ThreadStart(tlpublish.ExecuteTaskOnlineWrite )); secondTaskThread.Name = "Publish Second Task"; secondTaskThread.IsBackground = true; runningPublish = true; btnCancel.Label = "_Cancel"; secondTaskThread.Start(); } }
public void SecondTaskThreadRun() { try { while (play){ if ((!isPrimary) && (!isBussy) && (secondTaskList != null)) { isBussy = true; lock (secondTaskList) { //Console.WriteLine("secondTaskList THREAD RUNING"); //secondTaskList.ExecuteTask(); secondTaskList.ExecuteTaskOnlineWrite(); secondTaskList = null; } //Thread.Sleep (1000); isBussy = false; } Thread.Sleep (500); } } catch(ThreadAbortException){ Thread.ResetAbort (); } }
private void OnTimeElapsed(object o, ElapsedEventArgs args) { DateTime now = DateTime.Now; TimeSpan ts = now.Subtract(lastPrecompile); if (ts.TotalMilliseconds > 5000) { timer.Enabled = false; TaskList tl = new TaskList(); tl.TasksList = new System.Collections.Generic.List<Moscrif.IDE.Task.ITask>(); PrecompileTask pt = new PrecompileTask(); pt.Initialize(new PrecompileData(editor.Document.Text, fileName)); tl.TasksList.Clear(); tl.TasksList.Add(pt); MainClass.MainWindow.RunSecondaryTaskList(tl, EndTaskWritte,true); lastPrecompile = DateTime.Now; } }
void OnKeyReleaseEvent(object s, Gtk.KeyReleaseEventArgs args) { if (args.Event.Key == Gdk.Key.Left || args.Event.Key == Gdk.Key.Right || args.Event.Key == Gdk.Key.Up || args.Event.Key == Gdk.Key.Down || args.Event.Key == Gdk.Key.Control_L || args.Event.Key == Gdk.Key.Control_R) return; //return; if (MainClass.Settings.PreCompile && isCompileExtension ) { DateTime now = DateTime.Now; TimeSpan ts = now.Subtract(lastPrecompile); if (ts.TotalMilliseconds > 5500) { //MainClass.MainWindow.ErrorOutput.Clear(); TaskList tl = new TaskList(); tl.TasksList = new System.Collections.Generic.List<Moscrif.IDE.Task.ITask>(); PrecompileTask pt = new PrecompileTask(); pt.Initialize(new PrecompileData(editor.Document.Text, fileName)); tl.TasksList.Clear(); tl.TasksList.Add(pt); MainClass.MainWindow.RunSecondaryTaskList(tl, EndTaskWritte,true); lastPrecompile = DateTime.Now; timer.Enabled = false; } } }
private void RunPublishTask(List<CombinePublish> list) { LoggingInfo log = new LoggingInfo(); log.LoggWebThread(LoggingInfo.ActionId.IDEEnd,project.ProjectName); if((!MainClass.Workspace.SignApp) ){ TaskList tlpublish = new TaskList(); tlpublish.TasksList = new System.Collections.Generic.List<Moscrif.IDE.Task.ITask>(); PublishTask pt = new PublishTask(); pt.ParentWindow = this; pt.Initialize(list); tlpublish.TasksList.Add(pt); MainClass.MainWindow.RunTaskList(tlpublish,true); } else { if(MainClass.User == null){ LoginRegisterDialog ld = new LoginRegisterDialog(this); int res = ld.Run(); if (res == (int)Gtk.ResponseType.Cancel){ ld.Destroy(); return; } ld.Destroy(); } TaskList tl = new TaskList(); tl.TasksList = new System.Collections.Generic.List<Moscrif.IDE.Task.ITask>(); SignPublishTask ct = new SignPublishTask(); ct.Initialize(list); ct.ParentWindow = this; tl.TasksList.Add(ct ); MainClass.MainWindow.RunTaskList(tl,false); } }