protected virtual void OnProcessEvent(ProcessEventArgs eventArgs) { if (ProcessEventOccurred != null) { ProcessEventOccurred(this, eventArgs); } }
/// <summary> /// Fires the console input event. /// </summary> /// <param name="args">The <see cref="ProcessEventArgs"/> instance containing the event data.</param> private void FireProcessInputEvent(ProcessEventArgs args) { // Get the event. var theEvent = OnProcessInput; if (theEvent != null) { theEvent(this, args); } }
static async Task ProcessEventHandler(ProcessEventArgs eventArgs) { // Write the body of the event to the console window Console.WriteLine("\tReceived event: {0} \n\tfrom partitionid {1}", Encoding.UTF8.GetString(eventArgs.Data.Body.ToArray()), eventArgs.Partition.PartitionId); // Update checkpoint in the blob storage so that the app receives only new events the next time it's run await eventArgs.UpdateCheckpointAsync(eventArgs.CancellationToken); }
private void ProcessInterface_OnProcessExit(object sender, ProcessEventArgs args) { Cursor.Current = Cursors.Default; updateClickCommand.CanExecuteChanged(); if (args.Code == 0) { return; // Zero return code == SUCCESS } UpdateProcessError.SetError(UpdateCommand, $"Update process FAILED with code {args.Code}"); }
/// <summary> /// Handles the OnProcessExit event of the processInterace control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="args">The <see cref="ProcessEventArgs"/> instance containing the event data.</param> void processInterace_OnProcessExit(object sender, ProcessEventArgs args) { // Are we showing diagnostics? if (ShowDiagnostics) { WriteOutput(Environment.NewLine + _processInterace.ProcessFileName + " exited.", Color.FromArgb(255, 0, 255, 0)); } IsProcessRunning = false; }
private static void OnProcessSimpleList(object sender, ProcessEventArgs e) { if (e.Logic.Cancelled) { return; } e.Logic.Notify(String.Format("Listing \t{0} \t{1} \t{2}", String.Format("{0,-50}", e.FileInfo.FullName), e.FileInfo.Length + " bytes", File.GetLastWriteTime(e.FileInfo.FullName))); AccumulateLength(e.Logic, e.FileInfo); }
private async Task ProcessEventHandler(ProcessEventArgs eventArgs) { var recipeItem = JsonSerializer.Deserialize <Recipe>(Encoding.UTF8.GetString(eventArgs.Data.Body.ToArray())); var recipeOperation = eventArgs.Data.Properties["operation"].ToString(); var recipeEventType = eventArgs.Data.Properties["type"].ToString(); RecipesBusMessage message = new RecipesBusMessage { type = recipeEventType, operation = recipeOperation, recipe = recipeItem }; _recipesSubscription = _recipesBusService.recipesObservable .Where(e => string.Equals(e.type, "nutriko/type/recipe")) .Subscribe <RecipesBusMessage>(async e => { _logger.LogInformation("Received recipe event: " + e.operation + " -- " + e.recipe.id); try { /** * This needs a lot of work - this is too ewwww **/ if (e.operation == "nutriko/operation/post") { var operation = await _recipesCosmosClient.AddRecipeAsync(e.recipe); _logger.LogInformation("Recipe committed to store: " + e.recipe.id ?? "no insert" + " with Etag: " + operation.ETag.Value); } if (e.operation == "nutriko/operation/upsert") { var operation = await _recipesCosmosClient.UpsertRecipeAsync(e.recipe); _logger.LogInformation("Recipe upsert to store: " + e.recipe.id ?? "no upsert" + " with Etag: " + operation.ETag.Value); } if (e.operation == "nutriko/operation/delete") { var operation = await _recipesCosmosClient.DeleteRecipeAsync(e.recipe); _logger.LogInformation("Recipe deleted: " + e.recipe.id ?? "no delete" + " with Etag: " + operation.ETag.Value); } } catch (Exception ex) { _logger.LogInformation("Recipe error: " + ex.Message); throw; } } ); _recipesBusService.PublishMessage(message); _logger.LogInformation("Check-pointing event... "); await eventArgs.UpdateCheckpointAsync(eventArgs.CancellationToken); _recipesSubscription.Dispose(); }
private static void OnProcessSimpleList(object sender, ProcessEventArgs e) { if (e.Logic.Cancelled) { return; } e.Logic.Notify(string.Format("Listing {0}", e.FileInfo.Name)); AccumulateLength(e.Logic, e.FileInfo); }
protected void _model_OnOutputUpdate(object sender, ProcessEventArgs e) { try { _view.OutputTextBox = e.Message; } catch (Exception ex) { UIHelper.ShowError(ex); } }
async Task ProcessEventHandler(ProcessEventArgs eventArgs) { string eventMessageJson = Encoding.UTF8.GetString(eventArgs.Data.Body.ToArray()); EventHubTrace message = JsonConvert.DeserializeObject <EventHubTrace>(eventMessageJson); await _eventSender.SendAsync("trace", message); /* Update checkpoint in the blob storage so that the app * receives only new events the next time it's run */ await eventArgs.UpdateCheckpointAsync(eventArgs.CancellationToken); }
public void Process_start_then_stop_before_subscribe_does_nothing_but_raises_later_events_after_subscribe() { ProcessEventsImpl parent = new ProcessEventsImpl(); ProcessTracker tracker = new ProcessTracker(parent); ProcessEventArgs e1 = new ProcessEventArgs() { Id = 101, ImageName = @"\A\B\C\X.exe", Timestamp = new DateTime(2000, 1, 2, 3, 4, 5, 6) }; parent.RaiseProcessStarted(e1); ProcessEventArgs e2 = new ProcessEventArgs() { Id = 101, Timestamp = new DateTime(2001, 2, 3, 4, 5, 6, 7), ExitCode = 202 }; parent.RaiseProcessStopped(e2); List <ProcessData> data = new List <ProcessData>(); tracker.ProcessStopped += delegate(object sender, ProcessDataEventArgs e) { Assert.Same(tracker, sender); data.Add(e.Data); }; ProcessEventArgs e3 = new ProcessEventArgs() { Id = 102, ImageName = @"\A\B\C\Y.exe", Timestamp = new DateTime(2002, 3, 4, 5, 6, 7, 8) }; parent.RaiseProcessStarted(e3); ProcessEventArgs e4 = new ProcessEventArgs() { Id = 102, Timestamp = new DateTime(2003, 4, 5, 6, 7, 8, 9), ExitCode = 303 }; parent.RaiseProcessStopped(e4); Assert.Equal(1, data.Count); Assert.Equal(102, data[0].Id); Assert.Equal("Y.exe", data[0].Name); Assert.Equal(new DateTime(2002, 3, 4, 5, 6, 7, 8), data[0].StartTime); Assert.Equal(new DateTime(2003, 4, 5, 6, 7, 8, 9), data[0].ExitTime); Assert.Equal(303, data[0].ExitCode); }
void debugger_ProcessStarted(object sender, ProcessEventArgs e) { if (debugger.Processes.Count == 1) { if (DebugStarted != null) { DebugStarted(this, EventArgs.Empty); } } e.Process.LogMessage += LogMessage; }
/// <summary> /// Handle panic and write failure events here. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Environment_OnProcess(object sender, ProcessEventArgs e) { if (e.EventType == EnvironmentEvent.Panic) { Trace.WriteLine("A panic event occurred!", "Panic"); } if (e.EventType == EnvironmentEvent.WriteEventFailure) { Trace.WriteLine("A write event failed to occur!", "Fatal"); } }
/// <summary> /// Handles the OnProcessOutput event of the processInterace control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="args">The <see cref="ProcessEventArgs"/> instance containing the event data.</param> void processInterace_OnProcessOutput(object sender, ProcessEventArgs args) { // Write the output, in white byte[] bytes = Encoding.Default.GetBytes(args.Content); string convertido = Encoding.UTF8.GetString(bytes); WriteOutput(convertido, Color.White); // Fire the output event. FireConsoleOutputEvent(args.Content); }
public Task Complete(ProcessEventArgs eventArgs) { LogContext.SetCurrentIfNull(_hostConfiguration.ReceiveLogContext); if (_data.TryGetValue(eventArgs.Partition.PartitionId, out var data)) { data.Complete(eventArgs); } return(TaskUtil.Completed); }
private IMessageProcessor GetProcessor(ProcessEventArgs @event) { var rawMessage = Encoding.UTF8.GetString(@event.Data.Body.ToArray()); if (rawMessage.IsValidJson()) { return(new JsonMessageProcessor()); } return(new RawMessageProcessor()); }
public IPendingConfirmation Add(ProcessEventArgs eventArgs) { var pendingConfirmation = new PendingConfirmation(_eventHubName, eventArgs); return(_confirmations.AddOrUpdate(pendingConfirmation.Offset, key => pendingConfirmation, (key, existing) => { existing.Faulted($"Duplicate key: {key}, partition: {eventArgs.Partition.PartitionId}"); return pendingConfirmation; })); }
private void Kinect_User_Updated(object sender, ProcessEventArgs <IUserChangedEvent> e) { _bodyparts[JointID.Spine].LeftPoint = e.Event.Spine.ToScreenPosition(new Size(640, 480), WindowSize); _log.DebugFormat("{0}:{1}", JointID.ElbowLeft, _bodyparts[JointID.ElbowLeft].LeftPoint); _log.DebugFormat("{0}:{1}", JointID.ShoulderLeft, _bodyparts[JointID.ShoulderLeft].RightPoint); //_bodyparts[JointID.RightShoulder].LeftTop = e.Event.RightShoulder.ToScreenPosition(new System.Windows.Size(640, 480), WindowSize); //_bodyparts[JointID.RightShoulder].RightBottom = e.Event.RightElbow.ToScreenPosition(new System.Windows.Size(640, 480), WindowSize); //_bodyparts[JointID.LeftHip].LeftTop = e.Event.LeftHip.ToScreenPosition(new System.Windows.Size(640, 480), WindowSize); ; //_bodyparts[JointID.LeftHip].RightBottom = e.Event.LeftKnee.ToScreenPosition(new System.Windows.Size(640, 480), WindowSize); //_bodyparts[JointID.RightHip].LeftTop = e.Event.RightHip.ToScreenPosition(new System.Windows.Size(640, 480), WindowSize); //_bodyparts[JointID.RightHip].RightBottom = e.Event.RightKnee.ToScreenPosition(new System.Windows.Size(640, 480), WindowSize); }
static Task ProcessEventHandler(ProcessEventArgs eventArgs) { var userLog = new JavaScriptSerializer().Deserialize <UserLog>(Encoding.UTF8.GetString(eventArgs.Data.Body.ToArray())); // Write the body of the event to the console window Console.WriteLine("\tReceived event from: {0}", userLog.ToString()); recievedAnyEvent = true; // This makes you only recieve new events eventArgs.UpdateCheckpointAsync(eventArgs.CancellationToken); return(Task.CompletedTask); }
public static Message GetSerializedMessage(this ProcessEventArgs args) { try { var message = Utf8Json.JsonSerializer.Deserialize <Message>(args.Data.BodyAsStream); return(message); } catch (Exception) { return(null); } }
async Task HandleMessage(ProcessEventArgs eventArgs) { LogContext.SetCurrentIfNull(_context.LogContext); try { await _executor.Push(() => Handle(eventArgs), Stopping).ConfigureAwait(false); } catch (OperationCanceledException e) when(e.CancellationToken == Stopping) { } }
async Task EventReceived(ProcessEventArgs eventArgs) { if (eventArgs.CancellationToken.IsCancellationRequested) { return; } try { ++eventIndex; ++eventsSinceLastCheckpoint; if (eventsSinceLastCheckpoint >= eventsPerBatch) { // Updating the checkpoint will interact with the Azure Storage. As a service call, // this is done asynchronously and may be long-running. You may want to influence its behavior, // such as limiting the time that it may execute in order to ensure throughput for // processing events. // // In our case, we'll limit the checkpoint operation to a second and request cancellation // if it runs longer. using CancellationTokenSource cancellationSource = new CancellationTokenSource(TimeSpan.FromSeconds(1)); try { await eventArgs.UpdateCheckpointAsync(cancellationSource.Token); eventsSinceLastCheckpoint = 0; Console.WriteLine("Created checkpoint"); } catch (TaskCanceledException) { Console.WriteLine("Checkpoint creation took too long and was canceled."); } Console.WriteLine(); } result.Add($"{eventArgs.Partition.PartitionId}: Event Received: { Encoding.UTF8.GetString(eventArgs.Data.Body.ToArray()) }"); await InvokeAsync(() => StateHasChanged()); } catch (Exception ex) { // For real-world scenarios, you should take action appropriate to your application. For our example, we'll just log // the exception to the console. Console.WriteLine(); Console.WriteLine($"An error was observed while processing events. Message: { ex.Message }"); Console.WriteLine(); } }
/// <summary> /// Event handler for processing IoT Hub messages. /// </summary> private async Task Client_ProcessEventAsync(ProcessEventArgs arg) { if (!_monitoringEnabled) { return; } if (ProcessEventAsync != null) { await ProcessEventAsync.Invoke(arg).ConfigureAwait(false); } }
private void detectionManager_ProcessItemChanged(object sender, ProcessEventArgs <PwdResetItem> e) { lock (this) { if (this.isClosing) { return; } try { this.BeginInvoke(new ThreadStart(delegate() { if (this.httperManager.TotalCount != this.progressProcess.Maximum) { this.progressProcess.Maximum = this.httperManager.TotalCount; this.progressProcess.Minimum = 0; } //string line = "\r\n" + e.Item.UserDetail; //txtLog.AppendText(line); //if IsTooManyAttempt,don't export to file and update progress //if (e.Item.IsTooManyAttempt) //{ // return; //} if (itemCount < this.httperManager.TotalCount) { this.progressProcess.Value = ++itemCount; } //FileExportManager.Instance.Output(e.Item, httperManager.HttperParamsItem); this.ShowProcessCount(false); if (txtLog.Lines.Length >= MaxLine) { txtLog.Clear(); } else { //txtLog.SelectedText = line; txtLog.ScrollToCaret(); } })); } catch (Exception ex) { WowLogManager.Instance.Info("Update UI error:" + ex.Message); } } }
private void Kinect_User_Updated(object sender, ProcessEventArgs<IUserChangedEvent> e) { _bodyparts[JointID.Spine].LeftPoint = e.Event.Spine.ToScreenPosition(new Size(640, 480), WindowSize); _log.DebugFormat("{0}:{1}", JointID.ElbowLeft, _bodyparts[JointID.ElbowLeft].LeftPoint); _log.DebugFormat("{0}:{1}", JointID.ShoulderLeft, _bodyparts[JointID.ShoulderLeft].RightPoint); //_bodyparts[JointID.RightShoulder].LeftTop = e.Event.RightShoulder.ToScreenPosition(new System.Windows.Size(640, 480), WindowSize); //_bodyparts[JointID.RightShoulder].RightBottom = e.Event.RightElbow.ToScreenPosition(new System.Windows.Size(640, 480), WindowSize); //_bodyparts[JointID.LeftHip].LeftTop = e.Event.LeftHip.ToScreenPosition(new System.Windows.Size(640, 480), WindowSize); ; //_bodyparts[JointID.LeftHip].RightBottom = e.Event.LeftKnee.ToScreenPosition(new System.Windows.Size(640, 480), WindowSize); //_bodyparts[JointID.RightHip].LeftTop = e.Event.RightHip.ToScreenPosition(new System.Windows.Size(640, 480), WindowSize); //_bodyparts[JointID.RightHip].RightBottom = e.Event.RightKnee.ToScreenPosition(new System.Windows.Size(640, 480), WindowSize); }
static async Task ProcessEventHandler(ProcessEventArgs eventArgs) { string ev_data = Encoding.UTF8.GetString(eventArgs.Data.Body.ToArray()); var headers = eventArgs.Data.Properties; if (!URL.StartsWith("http")) { await eventArgs.UpdateCheckpointAsync(eventArgs.CancellationToken); return; } Console.WriteLine(ev_data); //Console.ReadLine(); try { /* * if (!URL.StartsWith("http")) { * await eventArgs.UpdateCheckpointAsync(eventArgs.CancellationToken); * return; * } * * var responseMessage = SendToMotomo(URL, headers); * var statusCode = responseMessage.Result.StatusCode; * Console.Clear(); * Console.Write(eventArgs.Data.SequenceNumber); */ /* * if (System.Net.HttpStatusCode.OK == statusCode) * { * //Console.WriteLine(statusCode); * //Console.WriteLine(eventArgs.Data.PartitionKey); * //Console.WriteLine(eventArgs.Data.MessageId); * //Console.WriteLine(eventArgs.Data.Offset); * //Console.WriteLine(eventArgs.Data.SequenceNumber); * * await eventArgs.UpdateCheckpointAsync(eventArgs.CancellationToken); * }*/ } catch (Exception ex) { //await eventArgs.UpdateCheckpointAsync(eventArgs.CancellationToken); /* * if (System.Net.HttpStatusCode.OK == (await SendToMotomo(URL, headers)).StatusCode) { * await eventArgs.UpdateCheckpointAsync(eventArgs.CancellationToken); * }*/ Console.WriteLine(ex.Message); } }
/// <summary> /// Handle process event /// </summary> /// <param name="e"></param> private void ProcessEventHandler(ProcessEventArgs e) { // If the process id is equal to this id then // call local handler. if (e.Id == Id) { ProcessEventLocalHandler(e); } else { ProcessEventGlobalHandler(e); } }
private void ProcessChanged(object sender, ProcessEventArgs e) { if (e.count == 0) { Proceeding = false; } else { Proceeding = true; } OnPropertyChanged("Proceeding"); }
private void ProcessingSemanticType(object sender, ProcessEventArgs args) { var stMsg = new HopeRunnerAppDomainInterface.ProcessEventArgs() { FromMembraneTypeName = args.FromMembrane?.GetType()?.FullName, FromReceptorTypeName = args.FromReceptor?.GetType()?.FullName, ToMembraneTypeName = args.ToMembrane.GetType().FullName, ToReceptorTypeName = args.ToReceptor.GetType().FullName, SemanticTypeTypeName = args.SemanticType.GetType().FullName, }; Processing.Fire(this, stMsg); }
/// <summary> /// Raise data event /// </summary> /// <param name="e"></param> protected void RaiseProcessEvent(ProcessEventArgs e) { Logger.Info("PUBLISH:<ProcessEvent>({0}): {1}.RaiseProcessEvent() Id={2}", e.ProcessType, ClassName, e.Id); // Common settings e.Id = Id; if (e.Sender == null) { e.Sender = GetType(); } EventAggregator.GetEvent <ProcessEvent>().Publish(e); }
private void ProcessInterface_OnProcessError(object sender, ProcessEventArgs args) { if (args.Content.Length > 0 || args.Code != null) { if (!processExited) { EchoCommand($"Process sent error: {args.Content}"); ACEManager.Log.AddLogLine(args.Content); UpdateStatus(); ScrollConsole(); } } }
static async Task ProcessEventHandler(ProcessEventArgs eventArgs) { // Write the body of the event to the console window //Console.WriteLine("\tReceived event: {0}", Encoding.UTF8.GetString(eventArgs.Data.Body.ToArray())); var messageBody = Encoding.UTF8.GetString(eventArgs.Data.Body.ToArray()); Order order = JsonConvert.DeserializeObject <Order>(messageBody); // Here we would start the fulfillment process logger.LogWarning($"Shipping order to : {order.ShippingAddress.StreetAddress}, {order.ShippingAddress.City}, {order.ShippingAddress.State} {order.ShippingAddress.PostalCode}"); // Update checkpoint in the blob storage so that the app receives only new events the next time it's run await eventArgs.UpdateCheckpointAsync(eventArgs.CancellationToken); }
private void KinectUserUpdated(object sender, ProcessEventArgs<IUserChangedEvent> e) { var screenpoint = e.Event.HandRight.ToScreenPosition(new Size(640, 480), _screenResolution); var point = new Point(screenpoint.X, screenpoint.Y); Move(point); }
void FireEvent(ProcessAction processAction, ProcessEventArgs args) { if (processAction != null) { Array.ForEach(processAction.GetInvocationList(), action => { try { action.DynamicInvoke(this, args); } catch (Exception e) { Logger.Instance.Warn("When invoke a method error, details:[{0}] ", e.ToString()); } }); } }
void ReportReceived(object sender, ProcessEventArgs e) { if (++count >= randomizeInterval) { if (autoCheck.Checked) { this.BeginInvoke(new generalDelegate(ic.ApplyRandomizedFactor)); count = 0; } } }
private void _kinectUser_Updated(object sender, ProcessEventArgs<IUserChangedEvent> e) { if (_saveCalibrationData) { lock (_syncRoot) { switch (_calibration) { case 0: ConfigurationViewModel.NextSlideCorrection = FilterHelper.CalculateCorrection(e.Event.GetPoints(ConfigurationViewModel.NextSlide1, ConfigurationViewModel.NextSlide2)); break; case 1: ConfigurationViewModel.PreviousSlideCorrection = FilterHelper.CalculateCorrection(e.Event.GetPoints( ConfigurationViewModel.PreviousSlide1, ConfigurationViewModel.PreviousSlide2)); break; case 2: ConfigurationViewModel.TogglePointerCorrection = FilterHelper.CalculateCorrection(e.Event.GetPoints( ConfigurationViewModel.TogglePointer1, ConfigurationViewModel.TogglePointer2)); break; } _saveCalibrationData = false; } } if (ConfigurationViewModel.EnableTogglePointer) { OnLaserUpdated(e.Event.Id, e.Event.GetPoint(ConfigurationViewModel.MovePointer)); } }
void OnDebuggedProcessPaused(object sender, ProcessEventArgs e) { //var nodes = new StackFrameNode(e.Process.SelectedStackFrame).ChildNodes; // if (!lazyGrid.ItemsSource.ContainsNode(node)) // return; // TODO : find the current expression so we don't update every pin // var observable = new List<ITreeNode>(); // // foreach (var node in lazyGrid.ItemsSource) { // var resultNode = currentDebugger.GetNode(node.FullName); // // HACK for updating the pins in tooltip // observable.Add(resultNode); // } // // // update UI // var newSource = new VirtualizingIEnumerable<ITreeNode>(observable); // lazyGrid.ItemsSource = newSource; // lazyExpandersGrid.ItemsSource = newSource; }
protected virtual void OnProcessStarting(ProcessEventArgs args) { var temp = this.startingAction; this.FireEvent(temp, args); }
private void OnProcessed(ProcessEventArgs e) { if (Processed != null) { Processed(this, e); } }
private void OnProcessing(ProcessEventArgs e) { if (Processing != null) { Processing(this, e); } }
private void frmIPChanger_ClientOpenComplete(object sender, ProcessEventArgs e) { Output.Add("Client: ", e.ClientProcess.MainModule.FileName, " (version: ", e.ClientProcess.MainModule.FileVersionInfo.ProductVersion, ") was started!"); if (e.Server != null) { Output.Add("Selected Login Server: ", e.Server.Name, "(", e.Server.Ip, ":", e.Server.Port.ToString(), ")"); } else { Output.Add("Tibia global login server was selected."); } ClientProcess = e.ClientProcess; SelectedServer = e.Server; this.pnHost.Visible = true; ((KTibiaX.IPChanger.frm_StartClient)sender).Close(); pnHost.CurrentProcess = e.ClientProcess; Callback host = pnHost.HostProcess; host.BeginInvoke(HostProcess_Complete, host); }
private void _user_Updated(object sender, ProcessEventArgs<IUserChangedEvent> e) { PropertyInfo[] eventProperties = e.Event.GetType().GetProperties(); Type thisType = GetType(); eventProperties.AsParallel().ForAll(pi => { PropertyInfo prop = thisType.GetProperty(pi.Name); if (prop != null && prop.CanWrite) { if (pi.PropertyType == typeof(Point3D)) { var propValue = pi.GetValue(e.Event, null); var point = (Point3D) propValue; var newValue = new Point3D(point.X * PropertionModifier, point.Y * PropertionModifier, point.Z * PropertionModifier); prop.SetValue(this, newValue, null); } } }); }
void ActiveUserUpdated(object sender, ProcessEventArgs<IUserChangedEvent> e) { if (AngryBirdsMode == Visibility.Visible) SpinePoint = new Point(e.Event.Spine.X, e.Event.Spine.Y); if (!_controlMouse) { return; } lock (SyncRoot) { Point3D point; switch(_currentMode) { case ControlMode.MouseControl: point = e.Event.HandLeft.ToScreenPosition(new Size(640, 480), _screenResolution); break; case ControlMode.AngryBirds: point = e.Event.Spine.ToScreenPosition(new Size(640, 480), _screenResolution); break; default: return; } MouseSimulator.Position = new Point(point.X, point.Y); } }
void ReportReceived(object sender, ProcessEventArgs e) { double progress = e.progress; int value = (int)Math.Round((seekBar.Maximum * e.progress)); if (value > seekBar.Maximum) value = seekBar.Maximum; seekBar.BeginInvoke(new progressDelegate(ChangeProgress), new object[] { value, e.maxTimeSeconds }); if (value == seekBar.Maximum && !repeatCheck.Checked) { playButton.BeginInvoke(new generalDelegate(ChangePlayButton)); } if (value < seekBar.Maximum && playButtonIsPlay) { // if sound played but playButton is not "Pause" playButton.BeginInvoke(new generalDelegate(ChangePlayButton)); } if (titleLabel.Text != e.title) { titleLabel.BeginInvoke(new stringDelegate(SetTitle), new object[] {e.title}); } }
void OnProcessSelected(object sender, ProcessEventArgs e) { Opacity = 1d; if (currentDebugger.DebuggedProcess != null) currentDebugger.DebuggedProcess.Paused += OnDebuggedProcessPaused; }
public void Process(Document doc) { ProcessEventArgs e = new ProcessEventArgs(doc); ProcessCancelEventArgs ce = new ProcessCancelEventArgs(doc); OnProcessing(ce); // if (ce.Cancel) { GetMessages.Message += "<br>Process canceled."; if (LogTextProvider != null) { GetMessages.Message += LogTextProvider(doc); } return; } foreach (ActionCheckPair process in processes) { if (process.QuickCheck != null && !process.QuickCheck(doc)) { GetMessages.Message += "<br> The process will not succeed."; if (LogTextProvider != null) { GetMessages.Message += "<br>" + LogTextProvider(doc); } OnProcessed(e); return; } } foreach (ActionCheckPair process in processes) { process.Action(doc); if (LogTextProvider != null) { GetMessages.Message += "<br>" + LogTextProvider(doc); } } OnProcessed(e); }
void debugger_ProcessStarted(object sender, ProcessEventArgs e) { e.Process.ThreadStarted += delegate(object sender2, ThreadEventArgs f) { ObjectDump("ThreadStartedEvent", f.Thread); }; }
private void OnProcessed(ProcessEventArgs e) { Delegate eh = null; if (events != null && events.TryGetValue("Processed", out eh)) { EventHandler<ProcessEventArgs> pceh = eh as EventHandler<ProcessEventArgs>; if (pceh != null) { pceh(this, e); } } }
private void _user_Updated(object sender, ProcessEventArgs<IUserChangedEvent> e) { PropertyInfo[] eventProperties = e.Event.GetType().GetProperties(); Type thisType = GetType(); eventProperties.AsParallel().ForAll(pi => { PropertyInfo prop = thisType.GetProperty(pi.Name); if (prop != null && prop.CanWrite) { object propValue = pi.GetValue(e.Event, null); object newValue = propValue; if (pi.PropertyType == typeof (Point3D)) { newValue = ((Point3D) propValue); } prop.SetValue(this, newValue, null); } }); }