public MainWindow() { InitializeComponent(); //ui_line.Start = new Point(0, 0); //ui_line.End = new Point(50, 50); //测试数据 actor = new Actor(diagram) { acName = "abc" }; Activity activity = new Activity(actor) { ActivityName = "ddd", Pos = 100 }; actor.AddAactivity(activity); Actor act = new Actor(diagram) { acName = "cba" }; Activity activity1 = new Activity(act) { ActivityName = "1231", Pos = 300 }; act.AddAactivity(activity1); diagram.AddActors(actor); diagram.AddActors(act); Transfer transtar = new Transfer(activity,activity1); diagram.AddTransfer(transtar); ui_Diagram.DataContext = diagram; //ui_ActorListBox.ItemsSource = diagram.Actors; //ui_Transfer.ItemsSource = diagram.Transfer; }
public void EditActivity(IDomainContext context, Activity activity) { var window = new EditActivityWindow(); window.ViewModel.DomainContext = context; window.ViewModel.Activity = activity; ShowCustomDialog(window); }
internal DebugManager(Activity root, string moduleNamePrefix, string typeNamePrefix, string auxiliaryThreadName, bool breakOnStartup, WorkflowInstance host, bool debugStartedAtRoot, bool resetDynamicModule) { if (resetDynamicModule) { dynamicModuleManager = null; } if (dynamicModuleManager == null) { dynamicModuleManager = new StateManager.DynamicModuleManager(moduleNamePrefix); } this.stateManager = new StateManager( new StateManager.Properties { ModuleNamePrefix = moduleNamePrefix, TypeNamePrefix = typeNamePrefix, AuxiliaryThreadName = auxiliaryThreadName, BreakOnStartup = breakOnStartup }, debugStartedAtRoot, dynamicModuleManager); this.states = new Dictionary<object, State>(); this.runningThreads = new Dictionary<int, Stack<Activity>>(); this.instrumentationTracker = new InstrumentationTracker(root); this.host = host; }
public void RequestTransport(CPos destination, Activity afterLandActivity) { var destPos = self.World.Map.CenterOfCell(destination); if (destination == CPos.Zero || (self.CenterPosition - destPos).LengthSquared < info.MinDistance.LengthSquared) { WantsTransport = false; // Be sure to cancel any pending transports return; } Destination = destination; this.afterLandActivity = afterLandActivity; WantsTransport = true; if (locked || Reserved) return; // Inform all idle carriers var carriers = self.World.ActorsWithTrait<Carryall>() .Where(c => !c.Trait.IsBusy && !c.Actor.IsDead && c.Actor.Owner == self.Owner && c.Actor.IsInWorld) .OrderBy(p => (self.Location - p.Actor.Location).LengthSquared); // Is any carrier able to transport the actor? // Any will return once it finds a carrier that returns true. carriers.Any(carrier => carrier.Trait.RequestTransportNotify(self)); }
public void addActivity(Activity act) { if(LstActivity.Count() < Parameter.DIX) LstActivity.Add(act); else System.Console.Write("Le nombre maximum d'activités est déjà atteint"); }
static bool IsPublicOrImportedDelegateOrChild(Activity parent, Activity child, out bool isReferencedChild) { isReferencedChild = false; if (child.Parent == parent) { if (child.HandlerOf == null) { return child.RelationshipToParent == Activity.RelationshipType.Child || child.RelationshipToParent == Activity.RelationshipType.ImportedChild; } else { return child.HandlerOf.ParentCollectionType == ActivityCollectionType.Public || child.HandlerOf.ParentCollectionType == ActivityCollectionType.Imports; } } else if (parent.MemberOf != child.MemberOf) { isReferencedChild = true; bool isImport; return IsChild(parent, child, out isImport); } else { return false; } }
public override Activity Tick(Actor self) { if (!target.IsValidFor(self)) return NextActivity; // Move to the next activity only if all ammo pools are depleted and none reload automatically // TODO: This should check whether there is ammo left that is actually suitable for the target if (ammoPools.All(x => !x.Info.SelfReloads && !x.HasAmmo())) return NextActivity; if (attackPlane != null) attackPlane.DoAttack(self, target); if (inner == null) { if (IsCanceled) return NextActivity; // TODO: This should fire each weapon at its maximum range if (attackPlane != null && target.IsInRange(self.CenterPosition, attackPlane.Armaments.Select(a => a.Weapon.MinRange).Min())) inner = ActivityUtils.SequenceActivities(new FlyTimed(ticksUntilTurn, self), new Fly(self, target), new FlyTimed(ticksUntilTurn, self)); else inner = ActivityUtils.SequenceActivities(new Fly(self, target), new FlyTimed(ticksUntilTurn, self)); } inner = ActivityUtils.RunActivity(self, inner); return this; }
public Job Change(Job job, JobStatus newStatus, Activity activity = null) { switch (newStatus) { case JobStatus.Ready: return CheckStatusAndInvoke(job, new[] {JobStatus.Created}, () => _jobMutator.Mutate<StatusChanger>(job, status: newStatus)); case JobStatus.Running: return CheckStatusAndInvoke(job, RunnableStatuses, () => _runningTransition.Transit(job)); case JobStatus.Completed: return CheckStatusAndInvoke(job, CompletableStatus, () => _endTransition.Transit(job, JobStatus.Completed)); case JobStatus.Failed: return CheckStatusAndInvoke(job, FallibleStatuses, () => _failedTransition.Transit(job)); case JobStatus.WaitingForChildren: return CheckStatusAndInvoke(job, AwaitableStatus, () => _waitingForChildrenTransition.Transit(job, activity)); case JobStatus.Poisoned: return CheckStatusAndInvoke(job, PoisonableStatus, () => _endTransition.Transit(job, JobStatus.Poisoned)); case JobStatus.Cancelling: return _jobMutator.Mutate<StatusChanger>(job, status: newStatus); case JobStatus.Cancelled: return _endTransition.Transit(job, JobStatus.Cancelled); } return job; }
static Activity CreateOrUpdateActivity(Activity activity, string packageName) { Console.WriteLine("Creating/Updating Activity..."); bool newlyCreated = false; if (activity == null) { activity = new Activity() { Id = ActivityName }; newlyCreated = true; } activity.Instruction = new Instruction() { Script = "_test\n" }; activity.Parameters = new Parameters() { InputParameters = { new Parameter() { Name = "HostDwg", LocalFileName = "$(HostDwg)" }, new Parameter() { Name = "ProductDb", LocalFileName="dummy.txt"} }, OutputParameters = { new Parameter() { Name = "Result", LocalFileName = "result.pdf" } } }; activity.RequiredEngineVersion = "20.1"; if (newlyCreated) { activity.AppPackages.Add(packageName); // reference the custom AppPackage container.AddToActivities(activity); } else container.UpdateObject(activity); container.SaveChanges(); return activity; }
public ActivityGroup AnyFailed(Activity next) { if (next == null) throw new ArgumentNullException("next"); OnAnyFailed = next; return this; }
public ActivityGroup Cancelled(SingleActivity next) { if (next == null) throw new ArgumentNullException("next"); OnCancel = next; return this; }
public TaskCollection(Activity owner) { Guard.ThrowExceptionIfNull(owner, "owner"); this.owner = owner; this.tasks = new List<Task>(); }
public void AddActivity(Activity activ) { if (LstActivities.Count <= Parameter.MAX_ACTIVITY) { LstActivities.Add(activ); } }
// case 1: StateMachine -> Default expression of StateMachine's variable -> ... // case 2: StateMachine -> InternalState -> ... public void ReplaceParentChainWithSource(Activity parentActivity, List<object> parentChain) { Activity lastActivity = parentChain[parentChain.Count - 1] as Activity; StateMachine stateMachine = (StateMachine)parentActivity; foreach (Variable variable in stateMachine.Variables) { if (variable != null && variable.Default == lastActivity) { parentChain.Add(stateMachine); return; } } if (parentChain.Count > 1) { // assume lastActivity is InternalState // remove InternalState parentChain.RemoveAt(parentChain.Count - 1); Activity targetActivity = (Activity)parentChain[parentChain.Count - 1]; // the targetActivity will be available in the path parentChain.RemoveAt(parentChain.Count - 1); List<object> path = FindRelativePath(stateMachine, targetActivity); foreach (object pathObject in path) { parentChain.Add(pathObject); } } }
public virtual void Queue(Activity activity) { if (NextActivity != null) NextActivity.Queue(activity); else NextActivity = activity; }
public void AddActivity(Activity activity) { this.Activities.Add(activity); if (this.Activities.Count == 1) this.Activities[0].Callback = this.ActivityDone; }
/// <summary> /// Make a profile updated joined activity object from the more generic database activity object /// </summary> /// <param name="activity"></param> /// <returns></returns> private ProfileUpdatedActivity GenerateProfileUpdatedActivity(Activity activity) { var cacheKey = string.Concat(CacheKeys.Activity.StartsWith, "GenerateProfileUpdatedActivity-", activity.GetHashCode()); return _cacheService.CachePerRequest(cacheKey, () => { var dataPairs = ActivityBase.UnpackData(activity); if (!dataPairs.ContainsKey(ProfileUpdatedActivity.KeyUserId)) { // Log the problem then skip _loggingService.Error($"A profile updated activity record with id '{activity.Id}' has no user id in its data."); return null; } var userId = dataPairs[ProfileUpdatedActivity.KeyUserId]; var user = _context.MembershipUser.FirstOrDefault(x => x.Id == new Guid(userId)); if (user == null) { // Log the problem then skip _loggingService.Error($"A profile updated activity record with id '{activity.Id}' has a user id '{userId}' that is not found in the user table."); return null; } return new ProfileUpdatedActivity(activity, user); }); }
private async void AddToCalendar(Activity tempActivity) { Appointment appointment = new Appointment(); //Activity tempActivity = LoadActivityValuesFromControls(); appointment.Subject = tempActivity.Title; appointment.Details = tempActivity.Description; appointment.Location = tempActivity.ContextUI; appointment.Reminder = TimeSpan.FromHours(1); appointment.StartTime = ((DateTimeOffset)tempActivity.StartDate).Date; string activityAppointmentId = string.Empty; // to powinno być pole aktywności activity.AppointmentId if (tempActivity.StartHour != null) appointment.StartTime += (TimeSpan)tempActivity.StartHour; if (tempActivity.EstimationId != null) appointment.Duration = TimeSpan.FromHours(LocalDatabaseHelper.ReadItem<Estimation>((int)tempActivity.EstimationId).Duration); var rect = new Rect(new Point(Window.Current.Bounds.Width / 2, Window.Current.Bounds.Height / 2), new Size()); string newAppointmentId; if (string.IsNullOrEmpty(activityAppointmentId)) { newAppointmentId = await AppointmentManager.ShowReplaceAppointmentAsync(activityAppointmentId, appointment, rect, Placement.Default); if (string.IsNullOrEmpty(newAppointmentId)) newAppointmentId = activityAppointmentId; } else newAppointmentId = await AppointmentManager.ShowAddAppointmentAsync(appointment, rect, Placement.Default); LocalDatabaseHelper.ExecuteQuery("UPDATE Activity SET AppointmentId = '" + newAppointmentId + "' WHERE Id = " + tempActivity.Id); App.PlannedWeekNeedsToBeReloaded = true; }
public CompiledExpressionInvoker(ITextExpression expression, bool isReference, CodeActivityMetadata metadata) { if (expression == null) { throw FxTrace.Exception.ArgumentNull("expression"); } if (metadata == null) { throw FxTrace.Exception.ArgumentNull("metadata"); } this.expressionId = -1; this.textExpression = expression; this.expressionActivity = expression as Activity; this.isReference = isReference; this.locationReferences = new List<LocationReference>(); this.metadata = metadata; this.accessor = CodeActivityPublicEnvironmentAccessor.Create(this.metadata); if (this.expressionActivity == null) { throw FxTrace.Exception.Argument("expression", SR.ITextExpressionParameterMustBeActivity); } ActivityWithResult resultActivity = this.expressionActivity as ActivityWithResult; this.metadataRoot = metadata.Environment.Root; this.ProcessLocationReferences(); }
public static int GetFrequency(ITashaPerson person, Activity activity, Random random, int maxFrequency) { int freq = 0; freq = Distribution.GetRandomFrequencyValue( 0, maxFrequency, random, Distribution.GetDistributionID( person, activity ) ); return freq; }
public static int GetFrequency(ITashaPerson person, Activity activity, Random random, int maxFrequency, Time startTime, Time endTime) { bool feasibleFreq = false; int freq = 0; while ( !feasibleFreq ) { freq = Distribution.GetRandomFrequencyValue( 0, maxFrequency, random, Distribution.GetDistributionID( person, activity ) ); if ( freq == 0 ) { break; } Time duration; if ( !Distribution.GetRandomStartTimeFrequency( Distribution.GetDistributionID( person, activity ), freq, Distribution.TimeOfDayToDistribution( startTime ), Distribution.TimeOfDayToDistribution( endTime ), random, out duration ) ) { //a bad thing happens here } else if ( duration != Time.Zero ) { feasibleFreq = true; } } return freq; }
public Activity GetMatch(Activity updatedChild) { this.ThrowIfDisposed(); if (updatedChild != null) { Activity result = this.matcher.GetMatch(updatedChild); if (updatedChild.MemberOf == this.targetActivity.MemberOf) { return result; } else if (result != null) { // GetMatch checks that the activities have the same relationship to declaring parent. // But for referenced children, we also need to check whether they have the same relationship // to referencing parent. // In case of multiple references from the same parent, we'll compare the first one we find. bool updatedIsImport; bool updatedIsReferenced = IsChild(this.TargetActivity, updatedChild, out updatedIsImport); bool updatedIsDelegate = updatedChild.HandlerOf != null; bool originalIsImport; bool originalIsReferenced = IsChild(GetMatch(this.TargetActivity), result, out originalIsImport); bool originalIsDelegate = result.HandlerOf != null; if (updatedIsReferenced && originalIsReferenced && updatedIsImport == originalIsImport && updatedIsDelegate == originalIsDelegate) { return result; } } } return null; }
public static int GetFrequency(ITashaPerson person, Activity activity, Random random, int maxFrequency, int householdPD, int workPD, GenerationAdjustment[] generationAdjustments) { int freq = 0; freq = Distribution.GetRandomFrequencyValue( 0, maxFrequency, random, Distribution.GetDistributionID(person, activity), householdPD, workPD, generationAdjustments); return freq; }
public void InsertActivityLogTest() { var log = new Activity(DateTime.Now, "Test", "Test Activity"); repository.Insert(log, "Contact", 1); Assert.IsNotNull(log.Id); }
public static Activity NewActivity(this IActivityRepository activityRepository, byte[] streamId, int pattern) { var id = Encoding.UTF8.GetBytes($"activity_{pattern}"); var activity = new Activity(streamId, id, new TestActivityBody($"body_{pattern}"), $"author_{pattern}", new DateTime(2000, 1, pattern)); activityRepository.Append(activity); return activity; }
static void benchmarkSystem_JobRemoved(object sender, JobEventArgs e) { Activity ac = new Activity(e.job, Job.JobState.Failed, System.DateTime.Now.Ticks); BenchmarkSystem.db.Activities.Add(ac); BenchmarkSystem.db.SaveChanges(); Console.WriteLine("Job Cancelled: " + e.job); }
static void benchmarkSystem_JobTerminated(object sender, JobEventArgs e) { Activity ac = new Activity(e.job, Job.JobState.Succesfull, System.DateTime.Now.Ticks); BenchmarkSystem.db.Activities.Add(ac); BenchmarkSystem.db.SaveChanges(); Console.WriteLine("Job Terminated: " + e.job); }
public void Add(Activity value) { if (value.Created == null || value.ChallengeID == 0) return; if (value.RowKey == null) value.RowKey = value.Created.ToString(); if (value.PartitionKey == null) value.PartitionKey = "Chal" + value.ChallengeID.ToString(); context.AttachTo(TableName, value, null); context.UpdateObject(value); context.SaveChangesWithRetries(); context.Detach(value); /* try { using (var redisClient = GetRedisClient()) { IRedisTypedClient<Activity> redis = redisClient.As<Activity>(); redis.SetEntry(this.RedisKeyForLatestActivity(value.ChallengeID), value); } } catch (Exception e) { System.Diagnostics.Trace.WriteLine("Activity repo exception: " + e.ToString()); } */ }
private static string _GetPerformance(string interval, Activity mg_old, Activity mg_new) { Activity mg_dif = mg_new - mg_old; if (mg_dif.Score > 0 || mg_dif.Rank != 0) { string result = @"\u{0}:\u ".FormatWith(interval); if (mg_dif.Score > 0) { result += @"\c03{0}\c score, ".FormatWith(mg_dif.Score); } if (mg_dif.Rank > 0) { result += @"\c3+{0}\c rank{1};".FormatWith(mg_dif.Rank, mg_dif.Rank > 1 ? "s" : string.Empty); } else if (mg_dif.Rank < 0) { result += @"\c4{0}\c rank{1};".FormatWith(mg_dif.Rank, mg_dif.Rank < -1 ? "s" : string.Empty); } return result.EndsWithI(", ") ? result.Substring(0, result.Length - 2) + ";" : result; } return null; }
protected override void Initialize(Activity activity) { base.Initialize(activity); HelpText = DR.GetString(DR.DropExceptionsHere); ShowPreview = false; }
public void OnActivityStarted(Activity activity) { CrossCurrentActivity.Current.Activity = activity; }
public void OnActivityCreated(Activity activity, Bundle savedInstanceState) { CrossCurrentActivity.Current.Activity = activity; }
public ResultListAdapter(Activity context) : this(context, -1, 0, false) { }
public ResultListAdapter(Activity context, float textWeight) : this(context, textWeight, 0, false) { }
/// <summary> /// Records incoming and outgoing activities to the Application Insights store. /// </summary> /// <param name="context">The context object for this turn.</param> /// <param name="nextTurn">The delegate to call to continue the bot middleware pipeline.</param> /// <param name="cancellationToken">A cancellation token that can be used by other objects /// or threads to receive notice of cancellation.</param> /// <returns>A task that represents the work queued to execute.</returns> /// <seealso cref="ITurnContext"/> /// <seealso cref="Bot.Schema.IActivity"/> public async Task OnTurnAsync(ITurnContext context, NextDelegate nextTurn, CancellationToken cancellationToken) { BotAssert.ContextNotNull(context); context.TurnState.Add(TelemetryLoggerMiddleware.AppInsightsServiceKey, _telemetryClient); // log incoming activity at beginning of turn if (context.Activity != null) { var activity = context.Activity; // Log the Application Insights Bot Message Received _telemetryClient.TrackEvent(BotMsgReceiveEvent, this.FillReceiveEventProperties(activity)); } // hook up onSend pipeline context.OnSendActivities(async(ctx, activities, nextSend) => { // run full pipeline var responses = await nextSend().ConfigureAwait(false); foreach (var activity in activities) { _telemetryClient.TrackEvent(BotMsgSendEvent, this.FillSendEventProperties(activity)); } return(responses); }); // hook up update activity pipeline context.OnUpdateActivity(async(ctx, activity, nextUpdate) => { // run full pipeline var response = await nextUpdate().ConfigureAwait(false); _telemetryClient.TrackEvent(BotMsgUpdateEvent, this.FillUpdateEventProperties(activity)); return(response); }); // hook up delete activity pipeline context.OnDeleteActivity(async(ctx, reference, nextDelete) => { // run full pipeline await nextDelete().ConfigureAwait(false); var deleteActivity = new Activity { Type = ActivityTypes.MessageDelete, Id = reference.ActivityId, } .ApplyConversationReference(reference, isIncoming: false) .AsMessageDeleteActivity(); _telemetryClient.TrackEvent(BotMsgDeleteEvent, this.FillDeleteEventProperties(deleteActivity)); }); if (nextTurn != null) { await nextTurn(cancellationToken).ConfigureAwait(false); } }
public static BusinessFlow ConvertRallyTestPlanToBF(RallyTestPlan testPlan) { try { if (testPlan == null) { return(null); } //Create Business Flow BusinessFlow busFlow = new BusinessFlow(); busFlow.Name = testPlan.Name; busFlow.ExternalID = "RallyID=" + testPlan.RallyID; busFlow.Status = BusinessFlow.eBusinessFlowStatus.Development; busFlow.Activities = new ObservableList <Activity>(); busFlow.Variables = new ObservableList <VariableBase>(); //Create Activities Group + Activities for each TC foreach (RallyTestCase tc in testPlan.TestCases) { //check if the TC is already exist in repository ActivitiesGroup tcActivsGroup; ActivitiesGroup repoActivsGroup = null; if (repoActivsGroup == null) { repoActivsGroup = GingerActivitiesGroupsRepo.Where(x => x.ExternalID != null ? x.ExternalID.Split('|').First().Split('=').Last() == tc.RallyID : false).FirstOrDefault(); } if (repoActivsGroup != null) { tcActivsGroup = (ActivitiesGroup)((ActivitiesGroup)(repoActivsGroup)).CreateInstance(); busFlow.AddActivitiesGroup(tcActivsGroup); busFlow.ImportActivitiesGroupActivitiesFromRepository(tcActivsGroup, GingerActivitiesRepo, true, true); busFlow.AttachActivitiesGroupsAndActivities(); } else // TC not exist in Ginger repository so create new one { tcActivsGroup = new ActivitiesGroup(); tcActivsGroup.Name = tc.Name; tcActivsGroup.Description = tc.Description; tcActivsGroup.ExternalID = "RallyID=" + tc.RallyID + "|AtsID=" + tc.BTSID; busFlow.AddActivitiesGroup(tcActivsGroup); } foreach (RallyTestStep step in tc.TestSteps) { Activity stepActivity; bool toAddStepActivity = false; // check if mapped activity exist in repository Activity repoStepActivity = (Activity)GingerActivitiesRepo.Where(x => x.ExternalID != null ? x.ExternalID.Split('|').First().Split('=').Last() == step.RallyIndex : false).FirstOrDefault(); if (repoStepActivity != null) { //check if it is part of the Activities Group ActivityIdentifiers groupStepActivityIdent = (ActivityIdentifiers)tcActivsGroup.ActivitiesIdentifiers.Where(x => x.ActivityExternalID == step.RallyIndex).FirstOrDefault(); if (groupStepActivityIdent != null) { //already in Activities Group so get link to it stepActivity = (Activity)busFlow.Activities.Where(x => x.Guid == groupStepActivityIdent.ActivityGuid).FirstOrDefault(); } else // not in ActivitiesGroup so get instance from repo { stepActivity = (Activity)repoStepActivity.CreateInstance(); toAddStepActivity = true; } } else //Step not exist in Ginger repository so create new one { string strBtsID = string.Empty; stepActivity = new Activity(); stepActivity.ActivityName = tc.Name + ">" + step.Name; stepActivity.ExternalID = "RallyID=" + step.RallyIndex + "|AtsID=" + strBtsID; stepActivity.Description = StripHTML(step.Description); stepActivity.Expected = StripHTML(step.ExpectedResult); toAddStepActivity = true; } if (toAddStepActivity) { // not in group- need to add it busFlow.AddActivity(stepActivity, tcActivsGroup); } //pull TC-Step parameters and add them to the Activity level foreach (RallyTestParameter param in tc.Parameters) // Params taken from TestScriptLevel only!!!! Also exists parameters at TestCase, to check if them should be taken!!! { bool?isflowControlParam = null; //determine if the param is Flow Control Param or not based on it value and agreed sign "$$_" if (param.Value.ToString().StartsWith("$$_")) { isflowControlParam = false; if (param.Value.ToString().StartsWith("$$_")) { param.Value = param.Value.ToString().Substring(3); //get value without "$$_" } } else if (param.Value.ToString() != "<Empty>") { isflowControlParam = true; } //check if already exist param with that name VariableBase stepActivityVar = stepActivity.Variables.Where(x => x.Name.ToUpper() == param.Name.ToUpper()).FirstOrDefault(); if (stepActivityVar == null) { //#Param not exist so add it if (isflowControlParam == true) { //add it as selection list param stepActivityVar = new VariableSelectionList(); stepActivityVar.Name = param.Name; stepActivity.AddVariable(stepActivityVar); stepActivity.AutomationStatus = eActivityAutomationStatus.Development;//reset status because new flow control param was added } else { //add as String param stepActivityVar = new VariableString(); stepActivityVar.Name = param.Name; ((VariableString)stepActivityVar).InitialStringValue = param.Value; stepActivity.AddVariable(stepActivityVar); } } else { //#param exist if (isflowControlParam == true) { if (!(stepActivityVar is VariableSelectionList)) { //flow control param must be Selection List so transform it stepActivity.Variables.Remove(stepActivityVar); stepActivityVar = new VariableSelectionList(); stepActivityVar.Name = param.Name; stepActivity.AddVariable(stepActivityVar); stepActivity.AutomationStatus = eActivityAutomationStatus.Development;//reset status because flow control param was added } } else if (isflowControlParam == false) { if (stepActivityVar is VariableSelectionList) { //change it to be string variable stepActivity.Variables.Remove(stepActivityVar); stepActivityVar = new VariableString(); stepActivityVar.Name = param.Name; ((VariableString)stepActivityVar).InitialStringValue = param.Value; stepActivity.AddVariable(stepActivityVar); stepActivity.AutomationStatus = eActivityAutomationStatus.Development;//reset status because flow control param was removed } } } //add the variable selected value if (stepActivityVar is VariableSelectionList) { OptionalValue stepActivityVarOptionalVar = ((VariableSelectionList)stepActivityVar).OptionalValuesList.Where(x => x.Value == param.Value).FirstOrDefault(); if (stepActivityVarOptionalVar == null) { //no such variable value option so add it stepActivityVarOptionalVar = new OptionalValue(param.Value); ((VariableSelectionList)stepActivityVar).OptionalValuesList.Add(stepActivityVarOptionalVar); if (isflowControlParam == true) { stepActivity.AutomationStatus = eActivityAutomationStatus.Development;//reset status because new param value was added } } //set the selected value ((VariableSelectionList)stepActivityVar).SelectedValue = stepActivityVarOptionalVar.Value; } else { //try just to set the value try { stepActivityVar.Value = param.Value; if (stepActivityVar is VariableString) { ((VariableString)stepActivityVar).InitialStringValue = param.Value; } } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {ex.Message}", ex); } } } } } return(busFlow); } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, "Failed to import Rally test set and convert it into " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), ex); return(null); } }
public void OnActivityStopped(Activity activity) { }
public void OnActivityResumed(Activity activity) { CrossCurrentActivity.Current.Activity = activity; }
public void OnActivityDestroyed(Activity activity) { }
public void OnActivitySaveInstanceState(Activity activity, Bundle outState) { }
public void OnActivityResumed(Activity activity) { }
public void OnActivityPaused(Activity activity) { }
/// <summary> /// Invoked when the bot deletes a message. /// Performs logging of telemetry data using the IBotTelemetryClient.TrackEvent() method. /// This event name used is "BotMessageDelete". /// </summary> /// <param name="activity">Current activity sent from user.</param> /// <param name="cancellation">A cancellation token that can be used by other objects /// or threads to receive notice of cancellation.</param> /// <returns>A task that represents the work queued to execute.</returns> protected virtual async Task OnDeleteActivityAsync(Activity activity, CancellationToken cancellation) { TelemetryClient.TrackEvent(TelemetryLoggerConstants.BotMsgDeleteEvent, await FillDeleteEventPropertiesAsync(activity).ConfigureAwait(false)); return; }
public void OnActivityStarted(Activity activity) { }
public LastFaultedBehavior(Activity <TInstance> activity) { _activity = activity; }
/// <summary> /// Fills the event properties for the BotMessageReceived. /// Adheres to the LogPersonalInformation flag to filter Name, Text and Speak properties. /// </summary> /// <param name="activity">Last activity sent from user.</param> /// <param name="additionalProperties">Additional properties to add to the event.</param> /// <returns>A dictionary that is sent as "Properties" to IBotTelemetryClient.TrackEvent method for the BotMessageReceived event.</returns> protected Task <Dictionary <string, string> > FillReceiveEventPropertiesAsync(Activity activity, Dictionary <string, string> additionalProperties = null) { var properties = new Dictionary <string, string>() { { TelemetryConstants.FromIdProperty, activity.From.Id }, { TelemetryConstants.ConversationNameProperty, activity.Conversation.Name }, { TelemetryConstants.LocaleProperty, activity.Locale }, { TelemetryConstants.RecipientIdProperty, activity.Recipient.Id }, { TelemetryConstants.RecipientNameProperty, activity.Recipient.Name }, }; // Use the LogPersonalInformation flag to toggle logging PII data, text and user name are common examples if (LogPersonalInformation) { if (!string.IsNullOrWhiteSpace(activity.From.Name)) { properties.Add(TelemetryConstants.FromNameProperty, activity.From.Name); } if (!string.IsNullOrWhiteSpace(activity.Text)) { properties.Add(TelemetryConstants.TextProperty, activity.Text); } if (!string.IsNullOrWhiteSpace(activity.Speak)) { properties.Add(TelemetryConstants.SpeakProperty, activity.Speak); } } // Additional Properties can override "stock" properties. if (additionalProperties != null) { return(Task.FromResult(additionalProperties.Concat(properties) .GroupBy(kv => kv.Key) .ToDictionary(g => g.Key, g => g.First().Value))); } return(Task.FromResult(properties)); }
private void gridGRVs_MouseClick(object sender, MouseEventArgs e) { DataRow SelectGRV = gridGRVsView.GetFocusedDataRow(); if (SelectGRV != null) { ReceiptID = Convert.ToInt32(SelectGRV["ReceiptID"]); PONumber = Convert.ToString(SelectGRV["PONumber"]); LoadSelectedGRVDetailForInvoiceEntry(ReceiptID); txtOrderNo.EditValue = SelectGRV["PONumber"]; txtInvoiceNo.EditValue = SelectGRV["InvoiceNumber"]; string space = ""; int length = ((string)SelectGRV["InvoiceNumber"]).Length; lcgInvoiceNo.Text = "Invoice No: " + (string)SelectGRV["InvoiceNumber"] + space.PadRight(180 - length) + "GRNF No: " + (string)SelectGRV["RefNo"].ToString(); lblMode.Text = (string)SelectGRV["Mode"] ?? "-"; lblAccount.Text = (string)SelectGRV["AccountName"] ?? "-"; lblSubAccount.Text = (string)SelectGRV["SubAccountName"] ?? "-"; lblActivity.Text = (string)SelectGRV["ActivityName"] ?? "-"; lblWarehouse.Text = (string)SelectGRV["WarehouseName"] ?? "-"; lblCluster.Text = (string)SelectGRV["ClusterName"] ?? "-"; lblReceiptType.Text = (string)SelectGRV["ReceiveType"] ?? "-"; lblReceiptStatus.Text = (string)SelectGRV["ReceiveStatus"] ?? "-"; lblSupplier.Text = (string)SelectGRV["SupplierName"] ?? "-"; lblOrderNo.Text = (string)SelectGRV["PONumber"] ?? "-"; lblConfirmedBy.Text = SelectGRV["ConfirmedBy"] == DBNull.Value ? "-" : (string)SelectGRV["ConfirmedBy"]; lblConfirmedDate.Text = SelectGRV["ConfirmedTime"] != DBNull.Value ? Convert.ToDateTime(SelectGRV["ConfirmedTime"]).ToShortDateString() : "-"; lblReceivedBy.Text = (string)SelectGRV["ReceivedBy"] ?? "-"; lblReceiptDate.Text = ((DateTime)SelectGRV["ReceivedTime"]).ToShortDateString() ?? "-"; lblInsurance.Text = SelectGRV["InsuranceNumber"] == DBNull.Value ? "" : (string)SelectGRV["InsuranceNumber"] ?? "-"; txtInsuranceNo.EditValue = SelectGRV["InsuranceNumber"]; lblInsurancePolicyNo.Text = SelectGRV["InsuranceNumber"].ToString() ?? "-"; txtTransfer.EditValue = SelectGRV["TransitNumber"]; lblTransferNo.Text = SelectGRV["TransitNumber"].ToString() ?? "-"; txtWayBill.EditValue = SelectGRV["WayBillNumber"]; lblWayBillNo.Text = SelectGRV["WayBillNumber"].ToString() ?? "-"; Activity Activity = new Activity(); Activity.LoadByPrimaryKey(Convert.ToInt32(SelectGRV["StoreID"])); txtActivity.EditValue = Activity.FullActivityName; lblActivity.Text = Activity.FullActivityName ?? "-"; var logReceiptStatus = new LogReceiptStatus(); var dtHistory = logReceiptStatus.GetLogHistory(ReceiptID, "PRC"); if (dtHistory != null && dtHistory.Count > 0) { lblCalcuatedBy.Text = (string)dtHistory[0]["FullName"]; lblCalculatedDate.Text = ((DateTime)dtHistory[0]["Date"]).ToShortDateString(); } else { lblCalculatedDate.Text = lblCalcuatedBy.Text = "-"; } } else { ResetForm(); } }
public void MostrarToast(string mensagem) { Activity activity = CrossCurrentActivity.Current.Activity; Toast.MakeText(Forms.Context, mensagem, ToastLength.Long).Show(); }
public CusotmListAdapter(Activity _context, List <RecommendModel> _list) : base() { this.context = _context; this.list = _list; }
private static HttpContent CreateContent(Activity activity) { string json = JsonConvert.SerializeObject(activity, MessageSerializerSettings.Create()); return new StringContent(json, Encoding.UTF8, "application/json"); }
public SynchronizeCachedDatabase(Activity context, IKp2aApp app, OnFinish finish) : base(context, finish) { _context = context; _app = app; }
public override Task <IActionResult> SendToConversationAsync(string conversationId, Activity activity) { try { return(base.SendToConversationAsync(conversationId, activity)); } catch (Exception ex) { Console.WriteLine(ex); throw; } }
public static void FindInDictionary(Activity mActivity, DictInfo currentDictionary, string s) { switch (currentDictionary.internalDict) { case 0: Intent intent = new Intent(currentDictionary.action); if (currentDictionary.className != null || Build.VERSION.SdkInt == BuildVersionCodes.Cupcake) { intent.SetComponent(new ComponentName(currentDictionary.packageName, currentDictionary.className)); } else { intent.SetPackage(currentDictionary.packageName); } intent.AddFlags(Build.VERSION.SdkInt >= BuildVersionCodes.EclairMr1 ? ActivityFlags.ClearTask : ActivityFlags.NewTask); if (s != null) { intent.PutExtra(currentDictionary.dataKey, s); intent.PutExtra(Intent.ExtraText, s); intent.SetType("text/plain"); } try { mActivity.StartActivity(intent); } catch (ActivityNotFoundException e) { System.Console.WriteLine("Dictionaries FindInDictionary ERROR => " + e.Message); throw new DictionaryException("Dictionary \"" + currentDictionary.name + "\" is not installed"); } break; case 1: string SEARCH_ACTION = currentDictionary.action; string EXTRA_QUERY = "EXTRA_QUERY"; string EXTRA_FULLSCREEN = "EXTRA_FULLSCREEN"; Intent intent1 = new Intent(SEARCH_ACTION); if (s != null) { intent1.PutExtra(EXTRA_QUERY, s); //Search Query } intent1.PutExtra(EXTRA_FULLSCREEN, true); try { mActivity.StartActivity(intent1); } catch (ActivityNotFoundException) { throw new DictionaryException("Dictionary \"" + currentDictionary.name + "\" is not installed"); } break; case 2: // Dictan support Intent intent2 = new Intent("android.intent.action.VIEW"); // Add custom category to run the Dictan external dispatcher intent2.AddCategory("info.softex.dictan.EXTERNAL_DISPATCHER"); // Don't include the dispatcher in activity // because it doesn't have any content view. intent2.SetFlags(ActivityFlags.NoHistory); intent2.PutExtra(DICTAN_ARTICLE_WORD, s); try { mActivity.StartActivityForResult(intent2, DICTAN_ARTICLE_REQUEST_CODE); } catch (ActivityNotFoundException) { throw new DictionaryException("Dictionary \"" + currentDictionary.name + "\" is not installed"); } break; case 3: Intent intent3 = new Intent("aard2.lookup"); intent3.AddFlags(ActivityFlags.NewTask | ActivityFlags.ClearTop); intent3.PutExtra(SearchManager.Query, s); try { mActivity.StartActivity(intent3); } catch (ActivityNotFoundException) { throw new DictionaryException("Dictionary \"" + currentDictionary.name + "\" is not installed"); } break; } }
public TangoListener(Activity currentActivity) { _TAG = typeof(TangoListener).Name; mCurrentActivity = currentActivity; Log.Info(_TAG, _TAG + " Constructed"); }
public override async Task <RecognizerResult> RecognizeAsync(DialogContext dialogContext, Activity activity, CancellationToken cancellationToken, Dictionary <string, string> telemetryProperties = null, Dictionary <string, double> telemetryMetrics = null) { // Identify matched intents var text = activity.Text ?? string.Empty; var locale = activity.Locale ?? "en-us"; var recognizerResult = new RecognizerResult() { Text = text, Intents = new Dictionary <string, IntentScore>(), }; // add entities from regexrecgonizer to the entities pool var entityPool = new List <Entity>(); var textEntity = new TextEntity(text); textEntity.Properties["start"] = 0; textEntity.Properties["end"] = text.Length; textEntity.Properties["score"] = 1.0; entityPool.Add(textEntity); foreach (var intentPattern in this.Intents) { var matches = intentPattern.Regex.Matches(text); if (matches.Count > 0) { // TODO length weighted match and multiple intents var intentKey = intentPattern.Intent.Replace(" ", "_"); if (!recognizerResult.Intents.ContainsKey(intentKey)) { recognizerResult.Intents.Add(intentKey, new IntentScore() { Score = 1.0, Properties = new Dictionary <string, object>() { { "pattern", intentPattern.Pattern } } }); } // Check for named capture groups // only if we have a value and the name is not a number "0" foreach (var groupName in intentPattern.Regex.GetGroupNames().Where(name => name.Length > 1)) { foreach (var match in matches.Cast <Match>()) { var group = (Group)match.Groups[groupName]; if (group.Success) { // add as entity to entity pool Entity entity = new Entity(groupName); entity.Properties["text"] = group.Value; entity.Properties["start"] = group.Index; entity.Properties["end"] = group.Index + group.Length; entityPool.Add(entity); } } } // found break; } } if (this.Entities != null) { // process entities using EntityRecognizerSet var entitySet = new EntityRecognizerSet(this.Entities); var newEntities = await entitySet.RecognizeEntities(dialogContext, text, locale, entityPool).ConfigureAwait(false); if (newEntities.Any()) { entityPool.AddRange(newEntities); } } // map entityPool of Entity objects => RecognizerResult entity format recognizerResult.Entities = new JObject(); foreach (var entityResult in entityPool) { // add value JToken values; if (!recognizerResult.Entities.TryGetValue(entityResult.Type, StringComparison.OrdinalIgnoreCase, out values)) { values = new JArray(); recognizerResult.Entities[entityResult.Type] = values; } // The Entity type names are not consistent, map everything to camelcase so we can process them cleaner. dynamic entity = JObject.FromObject(entityResult); ((JArray)values).Add(entity.text); // get/create $instance JToken instanceRoot; if (!recognizerResult.Entities.TryGetValue("$instance", StringComparison.OrdinalIgnoreCase, out instanceRoot)) { instanceRoot = new JObject(); recognizerResult.Entities["$instance"] = instanceRoot; } // add instanceData JToken instanceData; if (!((JObject)instanceRoot).TryGetValue(entityResult.Type, StringComparison.OrdinalIgnoreCase, out instanceData)) { instanceData = new JArray(); instanceRoot[entityResult.Type] = instanceData; } dynamic instance = new JObject(); instance.startIndex = entity.start; instance.endIndex = entity.end; instance.score = (double)1.0; instance.text = entity.text; instance.type = entity.type; instance.resolution = entity.resolution; ((JArray)instanceData).Add(instance); } // if no match return None intent if (!recognizerResult.Intents.Keys.Any()) { recognizerResult.Intents.Add("None", new IntentScore() { Score = 1.0 }); } await dialogContext.Context.TraceActivityAsync(nameof(RegexRecognizer), JObject.FromObject(recognizerResult), "RecognizerResult", "Regex RecognizerResult", cancellationToken).ConfigureAwait(false); this.TrackRecognizerResult(dialogContext, "RegexRecognizerResult", this.FillRecognizerResultTelemetryProperties(recognizerResult, telemetryProperties), telemetryMetrics); return(recognizerResult); }
public static Activity GetInstance() { if(_instance == null) _instance = new PlantActivity(ActivityType.Plant); return _instance; }
protected WorkflowInstance(Activity workflowDefinition) : this(workflowDefinition, null) { }
public Dictionaries(Activity activity) { mActivity = activity; currentDictionary = defaultDictionary(); }
protected abstract void OnNotifyUnhandledException(Exception exception, Activity source, string sourceInstanceId);
public override void ActivityEnd(uint eventTime, Activity activity, bool offlineMode = false) { AddExecutionDetailsToLog(eExecutionPhase.End, GingerDicser.GetTermResValue(eTermResKey.Activity), string.Format("{0} (ID:{1}, ParentID:{2})", activity.ActivityName, activity.Guid, activity.ExecutionParentGuid), new ActivityReport(activity)); }