/// <summary> /// Constructor /// </summary> /// <param name="entry"></param> /// <param name="currentTransition"></param> /// <param name="nextTransitions"></param> protected BaseWorkFlowAction(EntryState entry, Transition currentTransition, IEnumerable <Transition> nextTransitions) { EntryState = entry; CurrentTransition = currentTransition; NextTransitions = nextTransitions; Executor = IoC.Resolve <IWorkFlowExecutorService>(); }
public Entry(int num, Date d, string t) { number = num; date = d; text = t; state = EntryState.UNENCRYPTED; }
public void VisitTree(SyntaxNode root, EntryState state, SemanticModel?model, CancellationToken cancellationToken) { if (state == EntryState.Removed) { // mark both syntax *and* transform nodes removed _filterTable.RemoveEntries(); _transformTable.RemoveEntries(); } else { Debug.Assert(model is object); // get the syntax nodes from cache, or a syntax walk using the filter ImmutableArray <SyntaxNode> nodes; if (state != EntryState.Cached || !_filterTable.TryUseCachedEntries(out nodes)) { nodes = IncrementalGeneratorSyntaxWalker.GetFilteredNodes(root, _owner._filterFunc, cancellationToken); _filterTable.AddEntries(nodes, EntryState.Added); } // now, using the obtained syntax nodes, run the transform foreach (var node in nodes) { var value = new GeneratorSyntaxContext(node, model); var transformed = ImmutableArray.Create(_owner._transformFunc(value, cancellationToken)); if (state == EntryState.Added || !_transformTable.TryModifyEntries(transformed, _owner._comparer)) { _transformTable.AddEntries(transformed, EntryState.Added); } } } }
public static void Assert(this EntryState state, EntryState correct) { if (state != correct) { throw Error.Internal("Interaction was in an invalid state"); } }
static void CreateAIController() { AIController controller = CreateAssetAtSelectionPath <AIController> (); EntryState entryState = ScriptableObject.CreateInstance <EntryState> (); entryState.position = new Vector2(0, 0); entryState.name = "Entry"; AnyState anyState = ScriptableObject.CreateInstance <AnyState> (); anyState.position = new Vector2(0, 200); anyState.name = "Any"; controller.entryState = entryState; controller.anyState = anyState; #if SERIALIZER_DEBUG Debug.Log("Controller [" + controller.name + "] created."); #endif AddNewNodeToController(controller, entryState, false); AddNewNodeToController(controller, anyState, false); Save(); }
private void EntryEditDone_Click(object sender, EventArgs e) { if (_savepass.Root[tbxEntryName.Text] != null && _selectedEntry.Name != tbxEntryName.Text) { MessageBox.Show("Entry with this name is already exists", Application.ProductName); return; } _selectedEntry.Name = tbxEntryName.Text; _selectedEntry.Username = tbxUsername.Text; _selectedEntry.Password = tbxPassword.Text; _selectedEntry.Email = tbxEmail.Text; _selectedEntry.Website = tbxWebsite.Text; _selectedEntry.Notes = tbxNotes.Text; EntryRefresh(); panEntryInfo.Visible = true; panEntryEdit.Visible = false; panEntriesList.Enabled = true; menuStrip1.Enabled = true; toolStrip1.Enabled = true; _entryState = EntryState.None; _isFileSaved = false; this.Text = string.Format("{0} * Password Manager", _savepass.Root.Name); _savepass.Root.Sort(); dgEntries_Refresh(); }
/// <summary> /// Initializes a new instance of the <see cref="StateManager{T}"/> class. /// Sets active state with an initial state and sets basic configuration. /// </summary> /// <param name="algorithmConfiguration">The configuration of the algorithm.</param> /// <param name="container">Exchange service container.</param> /// <param name="initial">The initial state.</param> public StateManager( T algorithmConfiguration, ExchangeProvidersContainer container, EntryState <T> initial) { lock (_lock) { // Setup logging _configuration = algorithmConfiguration; _container = container; _logger = container.LoggerFactory.CreateLogger(GetType()); // Setup observing _timerObserver = container.TimerProvider.Subscribe( new ConfigurableObserver <long>( () => { }, _ => { }, tick => { if (_activeState is null) { Activate(initial); } OnMarketConditionEval(); EvaluateStateTimer(); })); _tradingObserver = container.TradingProvider.Subscribe( new ConfigurableObserver <OrderUpdate>( () => { }, _ => { }, OnOrderUpdateEval)); } }
private void EntryAdd_Click(object sender, EventArgs e) { _selectedEntry = new Entry("New entry"); _savepass.Root.Add(_selectedEntry); dgEntries_Refresh(); EntryEdit_Click(sender, e); _entryState = EntryState.Add; }
public void UpdateStateChange(EntryState state, long timestamp) { if (!IsStateChanged || StateChange.TimeStamp < timestamp || StateChange.TimeStamp == timestamp && state == EntryState.Undone) { StateChange = new Change <EntryState>(state, timestamp); } }
public History(Operations operation, long timestamp, int userId, EntryState state, string name) { this.operation = operation; this.timestamp = timestamp; this.userId = userId; this.state = state; this.name = name; }
private void AddStateInfo(int entryId, int userId, long timestamp, EntryState state) { if (!entriesStatus.ContainsKey(entryId)) { entriesStatus[entryId] = new SortedSet <ItemWithState>(); } entriesStatus[entryId].Add(new ItemWithState(userId, timestamp, state)); }
public void VisitTree( Lazy <SyntaxNode> root, EntryState state, Lazy <SemanticModel>?model, CancellationToken cancellationToken) { // We always have no inputs steps into a SyntaxInputNode, but we track the difference between "no inputs" (empty collection) and "no step information" (default value) var noInputStepsStepInfo = _filterTable.TrackIncrementalSteps ? ImmutableArray <(IncrementalGeneratorRunStep, int)> .Empty : default;
public async Task <Status> AddEntry(AddEntryDto addEntryDto, int userId) { var user = _mainDbContext.Users.FirstOrDefault(u => u.UserId == userId); if (user == null) { return(new Status(false, "User not exist")); } var passwordE = SymmetricEncryptor.EncryptString(addEntryDto.PasswordDecrypted, user.PasswordHash); //todo: add auto mapper var newEntry = new Entry { UserOwnerUsername = user.Username, }; var newEntryState = new EntryState { Username = addEntryDto.Username, PasswordE = passwordE, Description = addEntryDto.Description, Email = addEntryDto.Email, WebAddress = addEntryDto.WebAddress, IsDeleted = false }; newEntry.CurrentEntryState = newEntryState; var newUserEntry = new UsersEntries { IsUserOwner = true, Entry = newEntry, User = user }; var entryAction = CreateEntryAction(user, newEntryState, newEntry, ActionTypesEnum.Create); try { _mainDbContext.Update(user); _mainDbContext.Update(entryAction); _mainDbContext.Update(newUserEntry); await _mainDbContext.SaveChangesAsync(); return(new Status { Success = true, Message = "Added new password" }); } catch (Exception e) { Console.WriteLine(e); return(new Status { Success = false, Message = "Something went wrong" }); } }
public async Task <Status> DeleteEntry(int entryId, int userId) { var userEntry = await _mainDbContext.UsersEntries .Include(x => x.Entry.CurrentEntryState) .Include(x => x.User) .FirstOrDefaultAsync(ue => ue.EntryId == entryId && ue.UserId == userId); if (userEntry == null) { return(new Status(false, $"Cannot find entry with id: {entryId}")); } if (!userEntry.IsUserOwner) { return(new Status(false, "You cannot delete shared for you entry. You have to be an owner for delete.")); } var entry = userEntry.Entry; var currentEntryState = entry.CurrentEntryState; var newEntryState = new EntryState { PasswordE = currentEntryState.PasswordE, Username = currentEntryState.Username, Description = currentEntryState.Description, Email = currentEntryState.Email, WebAddress = currentEntryState.WebAddress, IsDeleted = true }; entry.CurrentEntryState = newEntryState; var entryAction = CreateEntryAction(userEntry.User, newEntryState, entry, ActionTypesEnum.Delete); try { await _mainDbContext.AddAsync(entryAction); await _mainDbContext.SaveChangesAsync(); return(new Status { Success = true, Message = $"Successfully removed entry with Id={entryId} from entries!" }); } catch (Exception e) { Console.WriteLine(e); return(new Status { Success = false, Message = "Something went wrong" }); } }
public Entry(Guid id, int projectNumber, TimePeriod timePeriod, string comment) : base(id) { this.ProjectNumber = projectNumber; this.Period = timePeriod; this.Comment = comment; _state = new EntryState(); }
private void on_Entry_KeyPress(object o, KeyPressEventArgs args) { Entry widget = (Entry)o; EntryState state = _entryStates.Find(m => m.EntryWidget == widget); if (state != null) { state.Text = widget.Text; } }
public virtual void Highlight() { Color = ParentMenu.Highlighted; _state = EntryState.Highlight; var handler = OnHighlight; if (handler != null) { handler(this, EventArgs.Empty); } }
public virtual void Normal() { Color = ParentMenu.Normal; _state = EntryState.Normal; var handler = OnNormal; if (handler != null) { handler(this, EventArgs.Empty); } }
/// <summary> /// Activates the state manager by feeding it the initial state. /// </summary> /// <param name="initial">The initial state.</param> private void Activate(EntryState <T> initial) { Guard.Argument(initial).NotNull(); if (_activeState != null) { throw new InvalidOperationException("Cannot activate the state manager when it is already active."); } _activeState = initial; SwitchState(_activeState.Activate(_configuration, _container)); }
public async Task <Status> EditEntry(EditEntryDto editEntryDto, int userId) { var owner = await _mainDbContext.Users.FirstOrDefaultAsync(user => user.UserId == userId); if (owner == null) { return(new Status(false, "User owner not found")); } var userEntry = await _mainDbContext.UsersEntries.Include(p => p.Entry.CurrentEntryState).FirstOrDefaultAsync(x => x.EntryId == editEntryDto.EntryId && x.UserId == userId); if (userEntry == null) { return(new Status(false, "Entry not found")); } if (!userEntry.IsUserOwner) { return(new Status(false, "You cannot edit shared for you entry. You have to be an owner for edit.")); } try { var newEntryState = new EntryState { PasswordE = SymmetricEncryptor.EncryptString(editEntryDto.PasswordDecrypted, owner.PasswordHash), Username = editEntryDto.Username, Description = editEntryDto.Description, Email = editEntryDto.Email, WebAddress = editEntryDto.WebAddress, IsDeleted = false }; userEntry.Entry.CurrentEntryState = newEntryState; var entryAction = CreateEntryAction(owner, newEntryState, userEntry.Entry, ActionTypesEnum.Edit); await _mainDbContext.AddAsync(entryAction); await _mainDbContext.SaveChangesAsync(); return(new Status(true, "Password has been successfully edited")); } catch (Exception e) { Console.WriteLine(e); return(new Status { Success = false, Message = "Something went wrong" }); } }
public void ExecutePipeline(IInvocationPipeline basePipeline, IInvocation invocation) { // Это нарушает solid, но позволяет не выставлять кучу классов наружу библиотеки. var pipeline = (InvocationPipeline)basePipeline; pipeline.Init(invocation); var entryState = new EntryState <InvocationPipeline>( pipeline.BoundaryAspects, pipeline.InterceptionAspect); InvocationStateMachine.Execute(pipeline, entryState); }
private void EntryEdit_Click(object sender, EventArgs e) { _selectedEntry = GetSelectedEntry(); EntryRefresh(); panEntryEdit.Visible = true; panEntryInfo.Visible = false; panEntriesList.Enabled = false; menuStrip1.Enabled = false; toolStrip1.Enabled = false; _entryState = EntryState.Edit; tbxEntryName.Focus(); }
private void decrypt() { string[] tokens = c.decrypt(hash, userKey).Split(' '); if (tokens.Length != 3) { throw new Exception("Decryption cannot be done"); } text = c.decrypt(tokens[0], KEY); date = new Date(tokens[1]); number = Convert.ToInt32(tokens[2]); state = EntryState.DECRYPTED; }
protected virtual void SaveOperationLog(string objectId, string detail, EntryState entryState) { var operation = new OperationLog { ObjectId = objectId, ObjectType = typeof(ApplicationUserExtended).Name, OperationType = entryState, Detail = detail }; _changeLogService.SaveChanges(operation); }
public void VisitTree(SyntaxNode root, EntryState state, SemanticModel?model, CancellationToken cancellationToken) { if (_walker is object && state != EntryState.Removed) { Debug.Assert(model is object); try { _walker.VisitWithModel(model, root); } catch (Exception e) { throw new UserFunctionException(e); } } }
private EntryAction CreateEntryAction(User user, EntryState entryState, Entry entry, ActionTypesEnum actionTypesEnum) { var entryAction = new EntryAction { ActionType = actionTypesEnum, Entry = entry, EntryState = entryState, User = user, DateTime = DateTime.Now, IsRestorable = true }; return(entryAction); }
private void EntryEditCancel_Click(object sender, EventArgs e) { if (_entryState == EntryState.Add) { _savepass.Root.Remove(_selectedEntry); } panEntryInfo.Visible = true; panEntryEdit.Visible = false; panEntriesList.Enabled = true; menuStrip1.Enabled = true; toolStrip1.Enabled = true; _entryState = EntryState.None; dgEntries_Refresh(); }
protected Entry(Bundle.HTTPVerb method, IKey key, DateTimeOffset?when, Resource resource) { if (resource != null) { key.ApplyTo(resource); } else { this.Key = key; } this.Resource = resource; this.Method = method; this.When = when ?? DateTimeOffset.Now; this.State = EntryState.Undefined; }
/// <summary> /// Execute actions /// </summary> /// <param name="entry"></param> /// <param name="transition"></param> /// <param name="data"></param> /// <returns></returns> public virtual async Task ExecuteActionsAsync(EntryState entry, Transition transition, Dictionary <string, string> data) { var actions = transition.TransitionActions.Select(x => x.Action).ToList(); var nextTransitions = await GetNextTransitionsAsync(transition); _backgroundTaskQueue.PushBackgroundWorkItemInQueue(async token => { foreach (var action in actions) { try { Type type = null; var memoryType = WorkFlowActionsStorage.GetActionType(action.ClassName); if (memoryType == null) { var findType = this.GetTypeFromAssembliesByClassName(action.ClassName); if (findType != null) { type = findType; WorkFlowActionsStorage.AppendActionType(action.ClassName, findType); } } else { type = memoryType; } if (type == null) { _logger.LogError($"Action {action.Name} was not found"); return; } var activatedObject = (BaseWorkFlowAction)Activator.CreateInstance(type, entry, transition, nextTransitions); if (activatedObject == null) { return; } await activatedObject.InvokeExecuteAsync(data); } catch (Exception e) { _logger.LogCritical(e, e.Message); } } }); }
private void UpdateUserStateChangeToEntry(int entryId, int userId, EntryState entryState, long timestamp) { if (IsNewUser(userId)) { throw new Exception(string.Format("Can't update changes of not initialized user {}", userId)); } if (!HasUserDoneAnyChangesToEntry(entryId, userId)) { InitializeUserChangesToEntry(entryId, userId); } if (usersLastChangesToEntry[userId][entryId].IsStateChanged && entriesChanges[entryId].StateChanges.ContainsChangeByUser(userId, usersLastChangesToEntry[userId][entryId].StateChange)) //BAD!!! { entriesChanges[entryId].StateChanges.ClearChange(userId, usersLastChangesToEntry[userId][entryId].StateChange); } usersLastChangesToEntry[userId][entryId].UpdateStateChange(entryState, timestamp); }
private IEnumerator FetchCoroutine() { HeaderWriter.ClearWriting(); Writer.WriteTextInstant ("Fetching..."); Task<ParseUser> fetchTask = ParseUser.CurrentUser.FetchIfNeededAsync (); DateTime startTime = DateTime.UtcNow; TimeSpan waitDuration = TimeSpan.FromSeconds(TimeUtils.TIMEOUT_DURATION); while (!fetchTask.IsCompleted) { if(DateTime.UtcNow - startTime >= waitDuration) break; yield return null; } if (!fetchTask.IsCompleted) { errorInfo = new ErrorInfo(ErrorType.Timeout); entryState = EntryState.Error; } else if(fetchTask.IsFaulted) { using (IEnumerator<System.Exception> enumerator = fetchTask.Exception.InnerExceptions.GetEnumerator()) { if (enumerator.MoveNext()) { ParseException exception = (ParseException) enumerator.Current; errorInfo = new ErrorInfo(ErrorType.ParseException, exception.Code); } else { errorInfo = new ErrorInfo(ErrorType.ParseInternal); } } entryState = EntryState.Error; } // we're done, what did we get? if (entryState != EntryState.Error) { PromptLoggedIn(); } else { Writer.WriteTextInstant(errorInfo.GetErrorStr() + "\n" + "[Tap] to refresh\n"); } }
private void PromptLoggedIn() { entryState = EntryState.LoggedIn; HeaderWriter.WriteTextInstant(MessageBook.AppName); Writer.WriteTextInstant ("Logged in: " + ParseUser.CurrentUser.Username + "\n"+ "[Tap] to play\n" + "[Hold] to logout"); }
private void PromptNormal() { entryState = EntryState.Normal; HeaderWriter.WriteTextInstant(MessageBook.AppName); Writer.WriteTextInstant ("[Tap] to play offline\n" + "[Hold] to login or signup"); }
public OrderChangeEvent(EntryState state, CustomerOrder origOrder, CustomerOrder modifiedOrder) { ChangeState = state; OrigOrder = origOrder; ModifiedOrder = modifiedOrder; }
void SetState(EntryState s) { this.entryState = s; this.lastStateChangeTime = Time.time; }
void DoEntryMovement() { target = wave.nb.endPos; DoTargetMovement(); if (AtTarget()) { this.entryState = EntryState.Loitering; } }
private bool TryChangeState(TrackingEntry trackingEntity, EntryState newState) { if (trackingEntity == null) { throw new ArgumentNullException("trackingEntity"); } var error = String.Format("Unable to change entity state from {0} -> {1}", trackingEntity.EntryState, newState); bool throwError = false; if (newState == EntryState.Modified) { switch (trackingEntity.EntryState) { case EntryState.Detached: case EntryState.Unchanged: trackingEntity.EntryState = EntryState.Modified; break; case EntryState.Added: case EntryState.Deleted: case EntryState.Modified: break; default: throwError = true; break; } } else if (newState == EntryState.Added) { switch (trackingEntity.EntryState) { case EntryState.Detached: case EntryState.Unchanged: trackingEntity.EntryState = EntryState.Added; break; default: throwError = true; break; } } else if (newState == EntryState.Deleted) { switch (trackingEntity.EntryState) { case EntryState.Unchanged: case EntryState.Modified: trackingEntity.EntryState = EntryState.Deleted; break; default: throwError = true; break; } } else if (newState == EntryState.Unchanged) { trackingEntity.EntryState = EntryState.Unchanged; } if (throwError) { Debug.WriteLine(error); // throw new InvalidOperationException(error); } return !throwError; }
/// <summary> /// Sets the neighbor to another room on the specified side. /// </summary> /// <param name='otherRoom'> /// The neighbor room. /// </param> /// <param name='side'> /// The side to which the neighbor room should be attached. /// </param> /// <param name='connectionState'> /// Specifies whether the neighboring room should be open or closed for access. /// </param> public void SetNeighbor(MazeRoom otherRoom, Cube.Side side, EntryState connectionState) { this.neighbors[(int)side] = otherRoom; this.entryStates[(int)side] = (otherRoom==null)?EntryState.Closed:connectionState; }
public MemberChangingEvent(EntryState state, Member member) { ChangeState = state; Member = member; }
private void Refresh() { var _entity = _party.Find(Id); if (_entity == null) { _entryState = EntryState.NotIn; _entryText.text = EntryInText; _entryButton.interactable = !_party.IsFull; } else { _entryState = EntryState.In; _entryText.text = EntryOutText; _entryButton.interactable = true; } }
public virtual void Select() { if (SubMenu != null) { _state = EntryState.Selected; Color = ParentMenu.Selected; SubMenu.ActivateScreen(); ParentMenu.ScreenManager.AddScreen(SubMenu); ParentMenu.FreezeScreen(); ParentMenu.HideMouse(); SubMenu.EnableMouse(ParentMenu.MouseTexture); } var handler = Selected; if (handler != null) { _state = EntryState.Selected; Color = ParentMenu.Selected; Selected(this, EventArgs.Empty); } }
void OnSwitchState(EntryState newState, EntryState oldState) { }
/// <summary> /// Set up our initial state. /// </summary> void DoInitialSpawn() { //We don't have any other kinds of entry behavior. this.transform.position = wave.nb.startPos; //Meh. Hardcode it. this.entryState = EntryState.Entering; //Immediately do a loiter change when we switch into it. this.nextLoiterChange = 0; this.nextShot = Random.Range(0f, 1f) * wave.at.fireInterval + Time.time; }
public CartChangeEvent(EntryState state, ShoppingCart origCart, ShoppingCart modifiedCart) { ChangeState = state; OrigCart = origCart; ModifiedCart = modifiedCart; }
/** Temporary(?) Elite control. It tries to follow what's in the wave. */ public void DoWave(SpawnTDS.Wave w) { this.wave = w; this.entryState = EntryState.Spawned; }
public QuoteRequestChangeEvent(EntryState state, QuoteRequest origQuote, QuoteRequest modifiedQuote) { ChangeState = state; OrigQuote = origQuote; ModifiedQuote = modifiedQuote; }