public void RaiseSupportEvent(SupportEvent evnt, string message, Object obj) { if (SupportEvent != null) { SupportEvent(evnt, message, obj); } }
public static string GetEventDescription(SupportEvent eventType) { switch (eventType) { default: return("未知事件类型"); case SupportEvent.Absent: return("消失"); case SupportEvent.AreaEvent: return("区域告警"); case SupportEvent.BatteryInsufficient: return("电量不足"); case SupportEvent.BatteryReset: return("电池重置"); case SupportEvent.ButtonPressed: return("触动按钮"); case SupportEvent.PositionChanged: return("位置改变"); case SupportEvent.WristletBroken: return("腕带断开"); } return(""); }
public void SupEvent(SupportEvent ev, string message, Object obj) { try { switch (ev) { case SupportEvent.eCompleted: break; case SupportEvent.eCancel: break; case SupportEvent.eProgress: break; case SupportEvent.eStarted: break; case SupportEvent.eSupportGenerated: m_engine3d.AddObject((Object3d)obj); // RaiseAppEvent(eAppEvent.eModelAdded, message); //add the model to the scene break; } } catch (Exception ex) { DebugLogger.Instance().LogError(ex.Message); } }
public void SupEvent(SupportEvent ev, string message, Object obj) { if (InvokeRequired) { BeginInvoke(new MethodInvoker(delegate() { SupEvent(ev, message, obj); })); } else { try { switch (ev) { case SupportEvent.eCompleted: //close this dialog progressTitle.Value = 0; progressTitle.Text = "Supports"; //DialogResult = System.Windows.Forms.DialogResult.OK; //Close(); System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; ListSupports(); break; case SupportEvent.eCancel: break; case SupportEvent.eProgress: // P string[] toks = message.Split('/'); int cs = int.Parse(toks[0]); int ts = int.Parse(toks[1]); if (cs == 0) // set up the prog bar on the first step { progressTitle.Maximum = ts; progressTitle.Text = "Generating..."; } else { progressTitle.Value = cs; } break; case SupportEvent.eStarted: break; case SupportEvent.eSupportGenerated: System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; ListSupports(); break; } } catch (Exception ex) { DebugLogger.Instance().LogError(ex.Message); } } }
private void AddSupEventButton_Click(object sender, RoutedEventArgs e) { // Check data if (Utility.TextHasNoData(this.SupNameTextBox) || Utility.TextHasNoData(this.SupDescTextBox) || Utility.TextHasNoData(this.TimeSupClose) || Utility.TextHasNoData(this.TimeSupOpen)) { MessageBox.Show("Please fill all of the fields"); return; } // Get time time if we can const DateTimeStyles style = DateTimeStyles.AllowWhiteSpaces; string todayDate = DateTime.Now.ToString("yyy-MM-dd"); DateTime closeTime; DateTime openTime; if ( !DateTime.TryParseExact(todayDate + " " + TimeSupClose.Text, "yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture, style, out closeTime)) { MessageBox.Show("Invalid HH:mm in CloseTime"); return; } if ( !DateTime.TryParseExact(todayDate + " " + TimeSupOpen.Text, "yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture, style, out openTime)) { MessageBox.Show("Invalid HH:mm in OpenTime"); return; } SupportEvent supportEvent = new SupportEvent { SupportEventDescription = SupDescTextBox.Text, SupportEventName = SupNameTextBox.Text, SupportEventStart = openTime, SupportEventStop = closeTime }; // Add it to the appropiate window if (_previousWindow is CreateTicketWindow) { CreateTicketWindow ticketWindow = (CreateTicketWindow)_previousWindow; ticketWindow.SupportEvents.Add(supportEvent); ticketWindow.Show(); this.Close(); } else { ViewTicketWindow ticketWindow = (ViewTicketWindow)_previousWindow; ticketWindow.SupportEvents.Add(supportEvent); ticketWindow.Show(); this.Close(); } }
// Module defining this command // Optional custom code for this activity /// <summary> /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run. /// </summary> /// <param name="context">The NativeActivityContext for the currently running activity.</param> /// <returns>A populated instance of System.Management.Automation.PowerShell</returns> /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks> protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context) { System.Management.Automation.PowerShell invoker = global::System.Management.Automation.PowerShell.Create(); System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName); // Initialize the arguments if (InputObject.Expression != null) { targetCommand.AddParameter("InputObject", InputObject.Get(context)); } if (EventName.Expression != null) { targetCommand.AddParameter("EventName", EventName.Get(context)); } if (SourceIdentifier.Expression != null) { targetCommand.AddParameter("SourceIdentifier", SourceIdentifier.Get(context)); } if (Action.Expression != null) { targetCommand.AddParameter("Action", Action.Get(context)); } if (MessageData.Expression != null) { targetCommand.AddParameter("MessageData", MessageData.Get(context)); } if (SupportEvent.Expression != null) { targetCommand.AddParameter("SupportEvent", SupportEvent.Get(context)); } if (Forward.Expression != null) { targetCommand.AddParameter("Forward", Forward.Get(context)); } if (MaxTriggerCount.Expression != null) { targetCommand.AddParameter("MaxTriggerCount", MaxTriggerCount.Get(context)); } return(new ActivityImplementationContext() { PowerShellInstance = invoker }); }
public void SupEvent(SupportEvent ev, string message, Object obj) { if (InvokeRequired) { BeginInvoke(new MethodInvoker(delegate() { SupEvent(ev, message, obj); })); } else { try { switch (ev) { case SupportEvent.eCompleted: //close this dialog progressTitle.Value = 0; progressTitle.Text = "Supports"; //DialogResult = System.Windows.Forms.DialogResult.OK; //Close(); ListSupports(); break; case SupportEvent.eCancel: break; case SupportEvent.eProgress: // P string[] toks = message.Split('/'); int cs = int.Parse(toks[0]); int ts = int.Parse(toks[1]); if (cs == 0) // set up the prog bar on the first step { progressTitle.Maximum = ts; progressTitle.Text = "Generating..."; } else { progressTitle.Value = cs; } break; case SupportEvent.eStarted: break; case SupportEvent.eSupportGenerated: ListSupports(); break; } } catch (Exception ex) { DebugLogger.Instance().LogError(ex.Message); } } }
public void SupEvent(SupportEvent ev, string message, Object obj) { //if() try { switch (ev) { case SupportEvent.eCompleted: List <Object3d> lstobjs = (List <Object3d>)obj; bool firstAdded = true; if (lstobjs != null) { foreach (Object3d o in lstobjs) { m_engine3d.AddObject((Object3d)o); UVDLPApp.Instance().m_undoer.SaveAddition((Object3d)o); if (!firstAdded) { UVDLPApp.Instance().m_undoer.LinkToPrev(); } firstAdded = false; } RaiseAppEvent(eAppEvent.eModelAdded, message); } break; case SupportEvent.eCancel: break; case SupportEvent.eProgress: break; case SupportEvent.eStarted: break; case SupportEvent.eSupportGenerated: //m_engine3d.AddObject((Object3d)obj); // RaiseAppEvent(eAppEvent.eModelAdded, message); //add the model to the scene break; } } catch (Exception) { //DebugLogger.Instance().LogError(ex.Message); // look more into the error being raised here on slicing completed } }
public void unspecified_typed_event_is_injected_into_command_as_typed_event() { SupportEvent injectedEvent = null; injector.Map(typeof(Action <SupportEventTriggeredSelfReportingCallbackCommand>), "ExecuteCallback").ToValue((Action <SupportEventTriggeredSelfReportingCallbackCommand>) delegate(SupportEventTriggeredSelfReportingCallbackCommand command) { injectedEvent = command.typedEvent; }); subject.Map(SupportEvent.Type.TYPE1) .ToCommand <SupportEventTriggeredSelfReportingCallbackCommand>(); SupportEvent supportEvent = new SupportEvent(SupportEvent.Type.TYPE1); dispatcher.Dispatch(supportEvent); Assert.That(injectedEvent, Is.EqualTo(supportEvent)); }
public void event_is_passed_to_execute_method() { SupportEvent actualEvent = null; injector.Map(typeof(Action <SupportEvent>), "ExecuteCallback").ToValue((Action <SupportEvent>) delegate(SupportEvent evt) { actualEvent = evt; }); subject.Map(SupportEvent.Type.TYPE1, typeof(SupportEvent)) .ToCommand <EventParametersCommand>(); SupportEvent supportEvent = new SupportEvent(SupportEvent.Type.TYPE1); dispatcher.Dispatch(supportEvent); Assert.That(actualEvent, Is.EqualTo(supportEvent)); }
[Test] //TODO: Make this unit test work public void event_is_injected_into_command() { IEvent injectedEvent = null; injector.Map(typeof(Action <EventInjectedCallbackCommand>), "ExecuteCallback").ToValue((Action <EventInjectedCallbackCommand>) delegate(EventInjectedCallbackCommand command) { injectedEvent = command.evt; }); subject.Map(SupportEvent.Type.TYPE1, typeof(IEvent)) .ToCommand <EventInjectedCallbackCommand>(); SupportEvent evt = new SupportEvent(SupportEvent.Type.TYPE1); dispatcher.Dispatch(evt); Assert.That(injectedEvent, Is.EqualTo(evt)); }
[Test] //TODO: Make this test pass public void event_is_injected_into_guard() { IEvent injectedEvent = null; injector.Map(typeof(Action <EventInjectedCallbackGuard>), "ApproveCallback").ToValue((Action <EventInjectedCallbackGuard>) delegate(EventInjectedCallbackGuard guard) { injectedEvent = guard.evt; }); subject .Map(SupportEvent.Type.TYPE1, typeof(IEvent)) .ToCommand <NullCommand>() .WithGuards <EventInjectedCallbackGuard>(); SupportEvent evt = new SupportEvent(SupportEvent.Type.TYPE1); dispatcher.Dispatch(evt); Assert.That(injectedEvent, Is.EqualTo(evt)); }
public void SupEvent(SupportEvent ev, string message, Object obj) { if (InvokeRequired) { BeginInvoke(new MethodInvoker(delegate() { SupEvent(ev, message, obj); })); } else { try { switch (ev) { case SupportEvent.eCompleted: UpdateSceneTree(); break; } } catch (Exception ex) { DebugLogger.Instance().LogError(ex.Message); } } }
/// <summary> /// Support Event handler /// </summary> /// <param name="ev"></param> /// <param name="message"></param> /// <param name="obj"></param> public void SupEvent(SupportEvent ev, string message, Object obj) { if (InvokeRequired) { BeginInvoke(new MethodInvoker(delegate() { SupEvent(ev, message, obj); })); } else { try { switch (ev) { case SupportEvent.eCompleted: ctl3DView1.UpdateSceneTree(); break; case SupportEvent.eCancel: break; case SupportEvent.eProgress: break; case SupportEvent.eStarted: break; case SupportEvent.eSupportGenerated: // // SetupSceneTree(); break; } } catch (Exception ex) { DebugLogger.Instance().LogError(ex.Message); } } }
public void SupEvent(SupportEvent ev, string message, Object obj) { //if() try { switch (ev) { case SupportEvent.eCompleted: List<Object3d> lstobjs = (List<Object3d>)obj; bool firstAdded = true; if (lstobjs != null) { foreach (Object3d o in lstobjs) { m_engine3d.AddObject((Object3d)o); UVDLPApp.Instance().m_undoer.SaveAddition((Object3d)o); if (!firstAdded) UVDLPApp.Instance().m_undoer.LinkToPrev(); firstAdded = false; } RaiseAppEvent(eAppEvent.eModelAdded, message); } break; case SupportEvent.eCancel: break; case SupportEvent.eProgress: break; case SupportEvent.eStarted: break; case SupportEvent.eSupportGenerated: //m_engine3d.AddObject((Object3d)obj); // RaiseAppEvent(eAppEvent.eModelAdded, message); //add the model to the scene break; } } catch (Exception ex) { DebugLogger.Instance().LogError(ex.Message); // look more into the error being raised here on slicing completed } }
public void AddSupportEvent(SupportEvent supportevent) { }
public void SupEvent(SupportEvent ev, string message, Object obj) { //if() try { switch (ev) { case SupportEvent.eCompleted: List<Object3d> lstobjs = (List<Object3d>)obj; if (lstobjs != null) { foreach (Object3d o in lstobjs) { m_engine3d.AddObject((Object3d)o); } RaiseAppEvent(eAppEvent.eModelAdded, message); } break; case SupportEvent.eCancel: break; case SupportEvent.eProgress: break; case SupportEvent.eStarted: break; case SupportEvent.eSupportGenerated: //m_engine3d.AddObject((Object3d)obj); // RaiseAppEvent(eAppEvent.eModelAdded, message); //add the model to the scene break; } } catch (Exception ) { //DebugLogger.Instance().LogError(ex.Message); // look more into the error being raised here on slicing completed } }
// Module defining this command // Optional custom code for this activity /// <summary> /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run. /// </summary> /// <param name="context">The NativeActivityContext for the currently running activity.</param> /// <returns>A populated instance of System.Management.Automation.PowerShell</returns> /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks> protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context) { System.Management.Automation.PowerShell invoker = global::System.Management.Automation.PowerShell.Create(); System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName); // Initialize the arguments if (Namespace.Expression != null) { targetCommand.AddParameter("Namespace", Namespace.Get(context)); } if (Credential.Expression != null) { targetCommand.AddParameter("Credential", Credential.Get(context)); } if (ComputerName.Expression != null) { targetCommand.AddParameter("ComputerName", ComputerName.Get(context)); } if (Class.Expression != null) { targetCommand.AddParameter("Class", Class.Get(context)); } if (Query.Expression != null) { targetCommand.AddParameter("Query", Query.Get(context)); } if (Timeout.Expression != null) { targetCommand.AddParameter("Timeout", Timeout.Get(context)); } if (SourceIdentifier.Expression != null) { targetCommand.AddParameter("SourceIdentifier", SourceIdentifier.Get(context)); } if (Action.Expression != null) { targetCommand.AddParameter("Action", Action.Get(context)); } if (MessageData.Expression != null) { targetCommand.AddParameter("MessageData", MessageData.Get(context)); } if (SupportEvent.Expression != null) { targetCommand.AddParameter("SupportEvent", SupportEvent.Get(context)); } if (Forward.Expression != null) { targetCommand.AddParameter("Forward", Forward.Get(context)); } if (MaxTriggerCount.Expression != null) { targetCommand.AddParameter("MaxTriggerCount", MaxTriggerCount.Get(context)); } return(new ActivityImplementationContext() { PowerShellInstance = invoker }); }