Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
 public static bool FinishSendHome(Session Session, System.Timers.Timer Timer)
 {
     Timer.Dispose();
             Timer.Stop();
             Session.CharacterInfo.UpdateSentHome(0);
             return true;
 }
Exemplo n.º 5
0
        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;
        }
Exemplo n.º 6
0
 public void Dispose()
 {
     if (!(manager is null))
     {
         System.Stop(manager);
         manager = null;
     }
 }
Exemplo n.º 7
0
        public void Shutdown()
        {
            if (_isTerminated.CompareAndSet(false, true))
            {
                LogInfo("Shutting down...");
                System.Stop(_clusterDaemons);
                _readView.Dispose();

                LogInfo("Successfully shut down");
            }
        }
Exemplo n.º 8
0
        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();
        }
Exemplo n.º 9
0
        public static void StopTimer(System.Diagnostics.Stopwatch timer, string text)
        {
            timer.Stop();

            if (!string.IsNullOrEmpty(text))
                text += ": ";

            var t = timer.ElapsedMilliseconds;
            if (t > 5)
            {
                System.Diagnostics.Debug.WriteLine(text + t.ToString("###,###,##0.00"));
            }
        }
Exemplo n.º 10
0
 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();
     }
 }
Exemplo n.º 11
0
 public static bool ExecuteTaxi(Session Session, RoomActor Actor, uint RoomID, System.Timers.Timer Timer)
 {
     Timer.Dispose();
             Timer.Stop();
             if (Session.CharacterInfo.Dead != 1 && Session.CharacterInfo.Jailed != 1)
             {
                 using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                 {
                     Session.CharacterInfo.SetHomeRoom(MySqlClient, RoomID);
                     RoomHandler.PrepareRoom(Session, RoomID, null, true);
                 }
             }
             return true;
 }
Exemplo n.º 12
0
        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;
        }
Exemplo n.º 13
0
        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;
        }
Exemplo n.º 14
0
 public void StopVoice(string characterLabel, float fadeTime)
 {
     System.Stop(IdVoice, characterLabel, fadeTime);
 }
Exemplo n.º 15
0
 private void ResetTimer(System.Timers.Timer timer)
 {
     if (timer != null)
     {
         timer.Stop();
         timer.Dispose();
         timer = null;
     }
 }
Exemplo n.º 16
0
 //
 // PerformClick(System.Timers.Timer timer, Random randomNumber)
 // Performs the clicking from the autoclicker
 //
 private void PerformClick(System.Timers.Timer timer, Random randomNumber)
 {
     try
     {
         Boolean KeyHeld = ((Control.MouseButtons & MouseButtons.Left) != 0);
         if ((!profileData.hold || (AutoclickerEnabled && KeyHeld)))
         {
             if (!AutoclickerActivated) //stop the autoclicker
             {
                 try
                 {
                     soundSemaphore.Release();
                 } catch { }
                 timer.Stop();
                 timer.Dispose();
                 return;
             }
             SimulatingClicksOnHold = true;
             PlayKeyCombo(profileData.AutoclickKey); //autoclick!
             SimulatingClicksOnHold = false;
             if (profileData.random && randomNumber != null)
                 timer.Interval = randomNumber.Next(profileData.MinDelay, profileData.MaxDelay);
         }
     }
     catch { }
     if (!AutoclickerActivated) //stop the autoclicker
     {
         try
         {
             soundSemaphore.Release();
         }
         catch { }
         timer.Stop();
         timer.Dispose();
         return;
     }
 }
Exemplo n.º 17
0
 public static void Reset(System.Timers.Timer timer)
 {
     timer.Stop();
     timer.Start();
 }
 private void Decorate(System.Windows.Forms.WebBrowser browser, string content)
 {
     string html_code = string.IsNullOrEmpty(content) ? "&nbsp;" : content;
     browser.Stop();
     if (browser.Document != null)
     {
         browser.Document.OpenNew(true);
         browser.Document.Write(html_code);
     }
     else
     {
         browser.DocumentText = html_code;
     }
     Application.DoEvents();
     if (browser.Document != null)
     {
         browser.Document.Focus();
         browser.Document.DomDocument.GetType().GetProperty("designMode").SetValue(browser.Document.DomDocument, "On", null);
     }
     browser.IsWebBrowserContextMenuEnabled = false;
 }
Exemplo n.º 19
0
			private void  closeSock(System.Net.Sockets.TcpListener s)
			{
				try
				{
					if (s != null)
						s.Stop();
				}
				catch (System.Exception)
				{
				}
			}
Exemplo n.º 20
0
 public void StopSe(string label, float fadeTime)
 {
     System.Stop(IdSe, label, fadeTime);
 }
Exemplo n.º 21
0
 private void killTimer(System.Timers.Timer time)
 {
     time.Stop();
     time.Dispose();
 }
Exemplo n.º 22
0
 private void ReportError(Exception ex, System.Diagnostics.Stopwatch stopWatch)
 {
     stopWatch.Stop();
     OutputText("------- ERROR: Processing Failed (" + DateTime.Now.ToString() + ") - Duration=" + stopWatch.Elapsed.ToString() + " ------");
     OutputText(ex.Message);
     OutputText(ex.StackTrace);
     if (ex.InnerException != null)
     {
         OutputText(ex.InnerException.Message);
         OutputText(ex.StackTrace);
     }
     _eventAggregator.GetEvent<StatusUpdateEvent>().Publish("Processing Failed");
 }
Exemplo n.º 23
0
        // 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();
        }
Exemplo n.º 24
0
 void ResetTimer(System.Windows.Forms.Timer timer)
 {
     timer.Stop();
     timer.Start();
 }
Exemplo n.º 25
0
 private void StopTimer(System.Timers.Timer tmrTarget)
 {
     if (tmrTarget != null && tmrTarget.Enabled)
     {
         tmrTarget.Stop();
     }
 }