//tester method to check if B.exe is working public static bool Tester(System.Diagnostics.Process process, string cube, bool expected) { int result; string tempCube; process.StartInfo.Arguments = cube; process.Start(); process.WaitForExit(); result = process.ExitCode; if (result == 1 && expected == true) { System.Console.WriteLine("not ok:"); tempCube = printcube(cube); System.Console.WriteLine(tempCube); System.Console.WriteLine("returned:no"); System.Console.WriteLine("expected:yes"); return true; } else if (result == 0 && expected == false) { System.Console.WriteLine("not ok:"); tempCube = printcube(cube); System.Console.WriteLine(tempCube); System.Console.WriteLine("returned:yes"); System.Console.WriteLine("expected:no"); return true; } else return false; }
public override bool Init(Main Main, System.Diagnostics.Stopwatch swInit) { if (!Main.EventMgr.PluginExists<Events.Screen>()) { this.Log.LogLine("Task \"LogScreenEvents\" is missing EventPlugin \"Screen\"!", Log.Type.Error); return false; } this.Main = Main; this.Log = Main.Log; swInit.Stop(); Events.Screen screenEvents = Main.EventMgr.GetPlugin<Events.Screen>(); swInit.Start(); screenEvents.ScreenAdded += new Events.EventPlugin.EventValue<ScreenEx>(screenEvents_ScreenAdded); screenEvents.ScreenRemoved += new Events.EventPlugin.EventValue<ScreenEx>(screenEvents_ScreenRemoved); screenEvents.ScreenColorDepthChanged += new Events.EventPlugin.EventValues<ScreenEx>(screenEvents_ScreenColorDepthChanged); screenEvents.ScreenResolutionChanged += new Events.EventPlugin.EventValues<ScreenEx>(screenEvents_ScreenResolutionChanged); screenEvents.PrimaryScreenChanged += new Events.EventPlugin.EventValues<ScreenEx>(screenEvents_PrimaryScreenChanged); screenEvents.ScreenLocationChanged += new Events.EventPlugin.EventValues<ScreenEx>(screenEvents_ScreenLocationChanged); screenEvents.ScreenOrientationChanged += new Events.EventPlugin.EventValues<ScreenEx>(screenEvents_ScreenOrientationChanged); screenEvents.ScreenRefreshRateChanged += new Events.EventPlugin.EventValues<ScreenEx>(screenEvents_ScreenRefreshRateChanged); return true; }
public override bool Init(Main Main, System.Diagnostics.Stopwatch swInit) { if (!Main.EventMgr.PluginExists<Events.System>()) { this.Log.LogLine("Task \"LogSystemEvents\" is missing EventPlugin \"System\"!", Log.Type.Error); return false; } this.Main = Main; this.Log = Main.Log; swInit.Stop(); Events.System sysEvents = Main.EventMgr.GetPlugin<Events.System>(); swInit.Start(); sysEvents.InstalledFontsChanged += new Events.EventPlugin.Event(sysEvents_InstalledFontsChanged); sysEvents.FontAdded += new Events.EventPlugin.EventValue<FontFamily>(sysEvents_FontAdded); sysEvents.FontRemoved += new Events.EventPlugin.EventValue<FontFamily>(sysEvents_FontRemoved); sysEvents.Logoff += new Events.EventPlugin.Event(sysEvents_Logoff); sysEvents.Shutdown += new Events.EventPlugin.Event(sysEvents_Shutdown); sysEvents.ConsoleConnect += new Events.EventPlugin.Event(sysEvents_ConsoleConnect); sysEvents.ConsoleDisconnect += new Events.EventPlugin.Event(sysEvents_ConsoleDisconnect); sysEvents.RemoteConnect += new Events.EventPlugin.Event(sysEvents_RemoteConnect); sysEvents.RemoteDisconnect += new Events.EventPlugin.Event(sysEvents_RemoteDisconnect); sysEvents.SessionLock += new Events.EventPlugin.Event(sysEvents_SessionLock); sysEvents.SessionLogoff += new Events.EventPlugin.Event(sysEvents_SessionLogoff); sysEvents.SessionLogon += new Events.EventPlugin.Event(sysEvents_SessionLogon); sysEvents.SessionRemoteControl += new Events.EventPlugin.Event(sysEvents_SessionRemoteControl); sysEvents.SessionUnlock += new Events.EventPlugin.Event(sysEvents_SessionUnlock); return true; }
public override bool Init(Main Main, System.Diagnostics.Stopwatch swInit) { if (!Main.EventMgr.PluginExists<Events.Power>()) { this.Log.LogLine("Task \"LogPowerEvents\" is missing EventPlugin \"Power\"!", Log.Type.Error); return false; } this.Main = Main; this.Log = Main.Log; swInit.Stop(); Events.Power pwrEvents = Main.EventMgr.GetPlugin<Events.Power>(new object[] {Main}, true); swInit.Start(); pwrEvents.PowerModeChanged += new Events.EventPlugin.EventValue<PowerModes>(pwrEvents_PowerModeChanged); pwrEvents.Suspend += new Events.EventPlugin.Event(pwrEvents_Suspend); pwrEvents.Resume += new Events.EventPlugin.Event(pwrEvents_Resume); pwrEvents.PowerLineStatusChanged += new Events.EventPlugin.EventValues<PowerLineStatus>(pwrEvents_PowerLineStatusChanged); pwrEvents.BatteryAvailabilityChanged += new Events.EventPlugin.EventValue<bool?>(pwrEvents_BatteryAvailabilityChanged); pwrEvents.BatteryStatusChanged += new Events.EventPlugin.EventValues<BatteryChargeStatus>(pwrEvents_BatteryStatusChanged); pwrEvents.PowerSchemeChanged += new Events.EventPlugin.EventValues<PowerScheme>(pwrEvents_PowerSchemeChanged); return true; }
public void Start(System.Threading.Tasks.Task task, ILogger log) { _log = log; task.ContinueWith(t => InvokeError(t, t.Exception.InnerException), TaskContinuationOptions.OnlyOnFaulted | TaskContinuationOptions.ExecuteSynchronously); task.Start(); }
public static long Snap(System.Diagnostics.Stopwatch sw, dbugCounterAction codeRgn) { sw.Stop(); sw.Reset(); sw.Start(); codeRgn(); sw.Stop(); //return sw.ElapsedMilliseconds; return sw.ElapsedTicks; }
static void HandleSessionSwitch(System.Timers.Timer timer, object sender, SessionSwitchEventArgs e) { if (e.Reason == SessionSwitchReason.SessionLock) { //I left my desk timer.Stop(); } else if (e.Reason == SessionSwitchReason.SessionUnlock) { //I returned to my desk timer.Start(); } }
public void Reset1(System.Windows.Threading.DispatcherTimer myDispatcherTimer1) { myDispatcherTimer1.Stop(); Each_Tick4(); myDispatcherTimer1.Start(); //myDispatcherTimer = new DispatcherTimer(); //myDispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 5000); // 100 Milliseconds //myDispatcherTimer.Tick += new EventHandler(Each_Tick); //myDispatcherTimer.Start(); }
static Heart() { Thread t = new Thread(new ThreadStart(() => { Timer = new Timer(OnBeat, null, #if DEBUG 6000, 6000 #else 45000, 45000 #endif ); })); t.Name = "MCG_Heartbeat"; t.Start(); }
public override bool Init(Main Main, System.Diagnostics.Stopwatch swInit) { if (!Main.EventMgr.PluginExists<Events.Network>()) { this.Log.LogLine("Task \"LogNetworkEvents\" is missing EventPlugin \"Network\"!", Log.Type.Error); return false; } this.Main = Main; this.Log = Main.Log; swInit.Stop(); Events.Network networkEvents = Main.EventMgr.GetPlugin<Events.Network>(); swInit.Start(); networkEvents.NetworkAvailabilityChanged += networkEvents_NetworkAvailabilityChanged; networkEvents.NetworkInterfaceAdded += networkEvents_NetworkInterfaceAdded; networkEvents.NetworkInterfaceRemoved += networkEvents_NetworkInterfaceRemoved; networkEvents.IpAddressChanged += networkEvents_IpAddrChanged; return true; }
public override bool Init(Main Main, System.Diagnostics.Stopwatch swInit) { if (!Main.EventMgr.PluginExists<Events.Device>()) { this.Log.LogLine("Task \"LogDeviceEvents\" is missing EventPlugin \"Device\"!", Log.Type.Error); return false; } this.Main = Main; this.Log = Main.Log; swInit.Stop(); Events.Device deviceEvents = Main.EventMgr.GetPlugin<Events.Device>(new object[] {Main}, true); swInit.Start(); deviceEvents.DeviceArrived += new Events.EventPlugin.EventValue<Device>(devEvents_DeviceArrived); deviceEvents.DeviceQueryRemove += new Events.EventPlugin.EventValue<Device>(devEvents_DeviceQueryRemove); deviceEvents.DeviceQueryRemoveFailed += new Events.EventPlugin.EventValue<Device>(devEvents_DeviceQueryRemoveFailed); deviceEvents.DeviceRemoved += new Events.EventPlugin.EventValue<Device>(devEvents_DeviceRemoved); deviceEvents.MediaInserted += new Events.EventPlugin.EventValue<Device>(devEvents_MediaInserted); deviceEvents.NetworkVolumeArrived += new Events.EventPlugin.EventValue<Device>(devEvents_NetworkVolumeArrived); return true; }
static void Main(string[] args) { // read ip-address IPAddress address; int port = 0; bool parseResult = true; do { System.Console.Write("Proxy IP address: "); string ipAddressString = System.Console.ReadLine(); parseResult = IPAddress.TryParse(ipAddressString, out address); if (!parseResult) { System.Console.WriteLine("Incorrect IP!"); } } while (!parseResult); do { System.Console.Write("Port: "); string portString = System.Console.ReadLine(); parseResult = int.TryParse(portString, out port); if (!parseResult) { System.Console.WriteLine("Incorrect IP!"); } } while (!parseResult); var proxy = new HttpProxyHandler(address, port, HttpParser.Instance, new HttpRequestSender(HttpWebRequestFactory.Instance), new SHA1HashProvider(), new CacheSlot<string, byte[]>(new MemoryCache<string, byte[]>(), new IsolatedStorageCache<string, byte[]>(s => s, b => b, b => b)), new RequestLogger); proxy.Start(); System.Console.WriteLine("Press any key to exit..."); System.Console.ReadKey(true); proxy.Dispose(); }
private void build( OGen.Libraries.Generator.Build notifyBack_in, // bool loadMetadata_in, IMetadata metadata_in, Statistics statistics_in, params string[] templateTypes_in ) { this.notifyback_ = notifyBack_in; //this.notifyback_("- common items", true); if (this.xmltemplatesfileuri_.IsFile) { this.xmltemplatesdir_ = Path.GetDirectoryName( this.xmltemplatesfileuri_.LocalPath ); } else { this.xmltemplatesdir_ = this.xmltemplatesfileuri_.ToString().Substring( 0, this.xmltemplatesfileuri_.ToString().LastIndexOf("/", StringComparison.CurrentCulture) ); } //this.metadata_ = new cDBMetadata(this.xmlmetadatafile_, this.xmlmetadataroot_); this.metadata_ = metadata_in; // if (loadMetadata_in) { //// ToDos: now! index must be sinchronized, not very convenient :( // for (int m = 0; m < this.metadatas_.Length; m++) { // this.metadatas_[m].LoadState_fromFile( // //this.xmlmetadatafile_, // this.metafiles_[m].Path, // //this.xmlmetadataroot_ // this.metafiles_[m].Root // ); // } // } this.templates_ = (this.xmltemplatesfileuri_.IsFile) ? XS__templates.Load_fromFile(this.xmltemplatesfileuri_.LocalPath)[0] : XS__templates.Load_fromURI(this.xmltemplatesfileuri_)[0] ; #region int _templateName_MaxLength = ...; int _templateName_MaxLength = 0; for (int i = 0; i < this.templates_.TemplateCollection.Count; i++) { if (this.templates_.TemplateCollection[i].ID.Length > _templateName_MaxLength) { _templateName_MaxLength = this.templates_.TemplateCollection[i].ID.Length; } } #endregion #if NET_1_1 OGen.Libraries.Worker.WorkItem[] _templatesState = new Worker.WorkItem[templates_.TemplateCollection.Count]; #else OGen.Libraries.Worker.WorkItem<XS_templateType>[] _templatesState = new Worker.WorkItem<XS_templateType>[this.templates_.TemplateCollection.Count]; #endif int _threadIterarionCounter = 0; object _threadIterarionCounterLocker = new object(); for (int i = 0; i < this.templates_.TemplateCollection.Count; i++) { // must check priorities, hence Waiting, otherwise Ready #region WorkItemState _state = (skipping) ? WorkItemState.Done : WorkItemState.Waiting; OGen.Libraries.Worker.WorkItemState _state = OGen.Libraries.Worker.WorkItemState.Waiting; if ( (templateTypes_in != null) && (templateTypes_in.Length > 0) && !string.IsNullOrEmpty(this.templates_.TemplateCollection[i].TemplateType) && !OGen.Libraries.Utilities.StringArrayContains( templateTypes_in, this.templates_.TemplateCollection[i].TemplateType ) ) { string _stepNum = (++_threadIterarionCounter).ToString(System.Globalization.CultureInfo.CurrentCulture); string _stepOf = this.templates_.TemplateCollection.Count.ToString(System.Globalization.CultureInfo.CurrentCulture); this.notifyback_( string.Format( System.Globalization.CultureInfo.CurrentCulture, "thread 0: {0}#{1}/{2} - {3} {4} skipping!", string.Empty.PadLeft(_stepOf.Length - _stepNum.Length, ' '), _stepNum, _stepOf, this.templates_.TemplateCollection[i].ID, string.Empty.PadLeft(_templateName_MaxLength - this.templates_.TemplateCollection[i].ID.Length + 3, '.') ), true ); _state = OGen.Libraries.Worker.WorkItemState.Done; } #endregion #if NET_1_1 _templatesState[i] = new OGen.Libraries.Worker.WorkItem( #else _templatesState[i] = new OGen.Libraries.Worker.WorkItem<XS_templateType>( #endif this.templates_.TemplateCollection[i], _state ); } OGen.Libraries.Worker.Worker _worker = new Worker.Worker(); int _numthreads = 4; WorkerThread[] _workthreads = new WorkerThread[_numthreads]; for (int t = 0; t < _workthreads.Length; t++) { #region DBConnectionstrings _dbconnectionstrings = ...; DBConnectionstrings _dbconnectionstrings = new DBConnectionstrings(); for (int d = 0; d < this.dbconnectionstrings_.Count; d++) { _dbconnectionstrings.Add( this.dbconnectionstrings_[d].DBServerType, this.dbconnectionstrings_[d].Connectionstring ); } for (int d = 0; d < _dbconnectionstrings.Count; d++) { _dbconnectionstrings[d].Connection_createInstance(); } #endregion #if DEBUG int T = t; #endif System.Threading.Thread _thread = new System.Threading.Thread(delegate() { #if NET_1_1 _worker.DoWork( #else _worker.DoWork<XS_templateType>( #endif _templatesState, delegate( #if NET_1_1 object template_in #else XS_templateType template_in #endif ) { #if NET_1_1 XS_templateType _template = (XS_templateType)template_in; #else XS_templateType _template = template_in; #endif #region int _finishedDependencies = ...; int _finishedDependencies = 0; for (int d = 0; d < _template.Dependencies.DependencyCollection.Count; d++) { for (int f = 0; f < _templatesState.Length; f++) { if ( _template.Dependencies.DependencyCollection[d].TemplateID == #if NET_1_1 ((XS_templateType)_templatesState[f].Item).ID #else _templatesState[f].Item.ID #endif ) { if (_templatesState[f].State == Worker.WorkItemState.Done) { _finishedDependencies++; } break; } } } #endregion return (_finishedDependencies == _template.Dependencies.DependencyCollection.Count); }, delegate( #if NET_1_1 object template_in #else XS_templateType template_in #endif ) { #if NET_1_1 XS_templateType _template = (XS_templateType)template_in; #else XS_templateType _template = template_in; #endif #if DEBUG long _begin = DateTime.Now.Ticks; #endif #region RUNNING: _template ... bool _valuehasbeenfound_out = false; this.metadata_.IterateThrough_fromRoot( _template.IterationType, delegate(string message_in) { this.notifyme( message_in, _template, _dbconnectionstrings, statistics_in ); }, ref _valuehasbeenfound_out ); #endregion int _threaditerarion; lock (_threadIterarionCounterLocker) { _threaditerarion = _threadIterarionCounter; _threadIterarionCounter = ++_threaditerarion; } #if DEBUG _workthreads[T].TotalTicks += DateTime.Now.Ticks - _begin; TimeSpan _end = new TimeSpan(DateTime.Now.Ticks - _begin); #endif string _stepNum = _threaditerarion.ToString(System.Globalization.CultureInfo.CurrentCulture); string _stepOf = this.templates_.TemplateCollection.Count.ToString(System.Globalization.CultureInfo.CurrentCulture); this.notifyback_( string.Format( System.Globalization.CultureInfo.CurrentCulture, #if DEBUG "thread {6}: {0}#{1}/{2} - {3} {4} {5} ({7}s {8}m)", #else "thread {6}: {0}#{1}/{2} - {3} {4} {5}", #endif string.Empty.PadLeft(_stepOf.Length - _stepNum.Length, ' '), _stepNum, _stepOf, #if NET_1_1 ((XS_templateType)template_in).ID, "".PadLeft(_templateName_MaxLength - ((XS_templateType)template_in).ID.Length + 3, '.'), #else template_in.ID, string.Empty.PadLeft(_templateName_MaxLength - template_in.ID.Length + 3, '.'), #endif (_valuehasbeenfound_out ? "DONE!" : "NOT doing!"), System.Threading.Thread.CurrentThread.Name #if DEBUG , Convert.ToInt32(_end.TotalSeconds), _end.Milliseconds #endif ), true ); } ); }); _thread.Name = string.Format( System.Globalization.CultureInfo.CurrentCulture, "{0}", t + 1 ); _thread.IsBackground = true; _workthreads[t] = new WorkerThread( _thread, _dbconnectionstrings ); _thread.Start(); } for (int t = 0; t < _workthreads.Length; t++) { _workthreads[t].Thread.Join(); #region _workthreads[t].DBConnectionstrings[0..n].Connection_createInstance(); for (int d = 0; d < _workthreads[t].DBConnectionstrings.Count; d++) { _workthreads[t].DBConnectionstrings[d].Connection_clearInstance(); } #endregion } #if DEBUG for (int t = 0; t < _workthreads.Length; t++) { TimeSpan _span = new TimeSpan(_workthreads[t].TotalTicks); Console.WriteLine( "thread {0}: work span: {1}s {2}m", _workthreads[t].Thread.Name, Convert.ToInt32(_span.TotalSeconds), _span.Milliseconds ); } #endif }
protected override void AfterRecieveCommand(AbonentsCommandMessage acMsg, Abonent ab) { switch (acMsg.Type) { case AbonentsCommandType.ExitRoom: { bool done = false; RemoveAbonent(ab); Program.Lobby.AddAbonent(ab); if (ab.Gamer.Id == this.Owner.Id) { AfterRemoveOwner(); } done = true; if (acMsg.GetInnerMessage().NeedConfirm) { ServerConfirmMessage confirm = new ServerConfirmMessage() { Accept = done, RefMsgId = acMsg.MsgId }; var smsg = confirm.GetTC(); ab.SendMessage(smsg); } SendRoomStatusMessage(); Program.Lobby.SendRoomStatusMessage(); break; } case AbonentsCommandType.Exit: { this.RemoveAbonent(ab); ab.Gamer.Name = "Guest" + ab.Gamer.Id; ab.Gamer.UserId = 0; ab.Status = AbonentStatusEnum.Disconnected; if (ab.Gamer.Id == this.Owner.Id) { AfterRemoveOwner(); } SendRoomStatusMessage(); break; } case AbonentsCommandType.StartRoom: { bool done = false; if (acMsg.GetInnerMessage().NeedConfirm) { MultiPlayerGame game = new MultiPlayerGame(this.AbnsToList(),); game.Start(AfterGameEnd); ServerConfirmMessage confirm = new ServerConfirmMessage() { Accept = done, RefMsgId = acMsg.MsgId }; var smsg = confirm.GetTC(); ab.SendMessage(smsg); } break; } case AbonentsCommandType.KickUser: { bool done = false; KickUserMessage kickmsg = (KickUserMessage)acMsg.GetInnerMessage(); Abonent kickedab = this.AbnsToList().FirstOrDefault(a => a.Gamer.Id==kickmsg.UserId); if (kickedab!=null) { this.RemoveAbonent(kickedab); Program.Lobby.AddAbonent(kickedab); done = true; } if (acMsg.GetInnerMessage().NeedConfirm) { ServerConfirmMessage confirm = new ServerConfirmMessage() { Accept = done, RefMsgId = acMsg.MsgId }; var smsg = confirm.GetTC(); ab.SendMessage(smsg); } SendRoomStatusMessage(); Program.Lobby.SendRoomStatusMessage(); break; } } }
//static I<int> AELight_TracePorts = null; #endif #endif protected internal static void AELight_StartTraceThread(System.Threading.Thread thd) { #if AELIGHT_TRACE lock (AELight_TraceThreads) { AELight_TraceThreads.Add(thd); } #endif thd.Start(); }
private void startTimer(System.Windows.Forms.Timer o, spellObject spellobject) { o.Interval = 1000; o.Start(); }
private static Task WaitingForTimer(Question qst, System.Windows.Threading.DispatcherTimer dt) { int sumOfTicks = 0; int neededTicks = qst.TimeToAnswer; dispatcherTimerTick = false; dt.Interval = new TimeSpan(0, 0, 1); dt.Tick += (sender, e) => { Dt_Tick(sender, e, ref sumOfTicks, neededTicks); }; dt.Start(); Task task = Task.Run(() => { while (sumOfTicks <= qst.TimeToAnswer) { if (!dt.IsEnabled) break; }; }); return task; }
public static void Reset(System.Timers.Timer timer) { timer.Stop(); timer.Start(); }
private void StartTimer(System.Timers.Timer tmrTarget) { if (tmrTarget != null && !tmrTarget.Enabled) { tmrTarget.Start(); } }
private void playlistAdded(Playlist playlist, System.Timers.Timer timer) { if (_playlistTimerRunning) { timer.Interval = 100; timer.Start(); } }
private static string RunCMD(string cmdstr, System.Diagnostics.Process pp) { string str = cmdstr; //System.Diagnostics.Process pp = new System.Diagnostics.Process(); pp.StartInfo.FileName = "cmd.exe"; pp.StartInfo.UseShellExecute = false; //是否使用操作系统shell启动 pp.StartInfo.RedirectStandardInput = true;//接受来自调用程序的输入信息 pp.StartInfo.RedirectStandardOutput = true;//由调用程序获取输出信息 pp.StartInfo.RedirectStandardError = true;//重定向标准错误输出 pp.StartInfo.CreateNoWindow = true;//不显示程序窗口 pp.Start();//启动程序 //向cmd窗口发送输入信息 pp.StandardInput.WriteLine(str + "&exit"); pp.StandardInput.AutoFlush = true; //向标准输入写入要执行的命令。这里使用&是批处理命令的符号,表示前面一个命令不管是否执行成功都执行后面(exit)命令,如果不执行exit命令,后面调用ReadToEnd()方法会假死 //同类的符号还有&&和||前者表示必须前一个命令执行成功才会执行后面的命令,后者表示必须前一个命令执行失败才会执行后面的命令 //获取cmd窗口的输出信息 string output = pp.StandardOutput.ReadToEnd(); return output; }
void StartTimer(ref System.Windows.Forms.Timer timer,int selectedType, string interval) { if(selectedType==3) { timer.Interval = Convert.ToInt32(interval)*1000; } else { timer.Interval = 1000; } timer.Start(); }
public void UpdateContent(string html) { Thread thread = new Thread (new ThreadStart (delegate { using (var a = new NSAutoreleasePool ()) { if (html == null) html = Controller.HTML; string pixmaps_path = Path.Combine ( NSBundle.MainBundle.ResourcePath, "Pixmaps"); html = html.Replace ("<!-- $body-font-family -->", "Lucida Grande"); html = html.Replace ("<!-- $day-entry-header-font-size -->", "13.6px"); html = html.Replace ("<!-- $body-font-size -->", "13.4px"); html = html.Replace ("<!-- $secondary-font-color -->", "#bbb"); html = html.Replace ("<!-- $small-color -->", "#ddd"); html = html.Replace ("<!-- $day-entry-header-background-color -->", "#f5f5f5"); html = html.Replace ("<!-- $a-color -->", "#0085cf"); html = html.Replace ("<!-- $a-hover-color -->", "#009ff8"); html = html.Replace ("<!-- $pixmaps-path -->", pixmaps_path); html = html.Replace ("<!-- $document-added-background-image -->", pixmaps_path + "/document-added-12.png")); html = html.Replace ("<!-- $document-deleted-background-image -->", pixmaps_path + "/document-deleted-12.png")); html = html.Replace ("<!-- $document-edited-background-image -->", pixmaps_path + "/document-edited-12.png")); html = html.Replace ("<!-- $document-moved-background-image -->", pixmaps_path + "/document-moved-12.png")); InvokeOnMainThread (delegate { if (this.progress_indicator.Superview == ContentView) this.progress_indicator.RemoveFromSuperview (); this.web_view.MainFrame.LoadHtmlString (html, new NSUrl ("")); ContentView.AddSubview (this.web_view); }); } })); thread.Start (); }
// Gives you a prompt for changing the tick speed public void changeTickSpeed(ref System.Timers.Timer timer, Sdx.Point location) { // Variables Label lbl= new Label(); TextBox tb= new TextBox(); Button ok= new Button(); Button cancel= new Button(); Location= new Sdx.Point(location.X, location.Y); Size= new Sdx.Size(320, 136); MinimumSize= new Sdx.Size(320, 136); MaximumSize= new Sdx.Size(320, 136); Text= "Change speed of timer"; interval= timer.Interval; lbl.Location= new Sdx.Point(8, 8); lbl.Size= new Sdx.Size(ClientSize.Width-16, 16); tb.Location= new Sdx.Point(8, 32); tb.Size= new Sdx.Size(ClientSize.Width-16, 24); ok.Location= new Sdx.Point(ClientSize.Width/2, 64); ok.Size= new Sdx.Size(ClientSize.Width/4-16, 24); cancel.Location= new Sdx.Point(ok.Location.X+ok.Size.Width+8, 64); cancel.Size= new Sdx.Size(ok.Size.Width, 24); lbl.Text= "Tick Speed"; tb.Text= interval.ToString(); ok.Text= "Ok"; cancel.Text= "Cancel"; tb.KeyPress+= delegate(object sender, KeyPressEventArgs args) { if(!bPeriodExists && args.KeyChar== '.') { bPeriodExists= true; return; } if((args.KeyChar< '0' || args.KeyChar> '9') && args.KeyChar!= '\b') args.Handled= true; }; tb.TextChanged+= delegate(object sender, EventArgs args) { if(!tb.Text.Contains(".")) bPeriodExists= false; }; ok.Click+= delegate(object sender, EventArgs args) { double.TryParse(tb.Text, out interval); Close(); }; cancel.Click+= delegate(object sender, EventArgs args) { Close(); }; Controls.Add(lbl); Controls.Add(tb); Controls.Add(ok); Controls.Add(cancel); ShowDialog(); Controls.Clear(); timer.Stop(); timer.Interval= interval; timer.Start(); }
void ResetTimer(System.Windows.Forms.Timer timer) { timer.Stop(); timer.Start(); }
private static bool StartProcess(SVNConfig config, System.Diagnostics.Process process, out string stdout, out string stderr) { if(config.enableDebugging) { Debug.Log(process.StartInfo.FileName + " " + process.StartInfo.Arguments); } bool result = false; try { result = process.Start(); } catch(System.Exception e) { Debug.LogError(e.Message); stdout = ""; stderr = e.Message; return false; } stdout = process.StandardOutput.ReadToEnd(); stderr = process.StandardError.ReadToEnd(); if(config.enableDebugging && stdout != "") { Debug.Log(stdout); } if(stderr != "") { Debug.LogError(stderr); } process.WaitForExit(); return result; }