Exemplo n.º 1
0
 /// <summary>
 /// Adds a ActionPerformed callback function to all of the group buttons.
 /// </summary>
 /// <param name="callback"></param>
 public virtual void AddActionPerformedHandler(ActionPerformed callback)
 {
     foreach (ToggleButton button in group)
     {
         button.ActionPerformedEvent += callback;
     }
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            ActionPerformed del1;

            del1 = new ActionPerformed(Calculate);
            del1(6);
            del1 = new ActionPerformed((x) => Console.WriteLine("x=" + x));
            del1(8);

            OnActionPerformed += del1; //przy każdym wywołaniu eventu, wywoływana jest delegata
            del1(10);
            OnActionPerformed -= del1;

            AddEvent aEv = new AddEvent();

            //MyEventArgs args = new MyEventArgs();
            //args.MyProperty = 6;
            OnEventPerformedArgs(null, new MyEventArgs()
            {
                MyProperty = 6
            });


            Console.ReadKey();
        }
Exemplo n.º 3
0
        void IActionHandler.HandleActionStateChanged(
            IUser user,
            ActionState oldState,
            ActionState newState,
            BaseActionData actionData)
        {
            MixedRealityExtensionApp app;

            if (!_appRef.TryGetTarget(out app))
            {
                return;
            }

            var actionPerformed = new ActionPerformed()
            {
                UserId       = user.Id,
                TargetId     = _attachedActorId,
                BehaviorType = _behaviorType,
                ActionName   = _actionName,
                ActionState  = newState,
                ActionData   = actionData
            };

            app.EventManager.QueueLateEvent(new BehaviorEvent(actionPerformed));
        }
Exemplo n.º 4
0
        public virtual void StopMove()
        {
            ElementMoveAction        moveAction          = new ElementMoveAction(this, _lastPoint, new Point(Left, Top));
            ActionPerformedEventArgs moveActionEventArgs = new ActionPerformedEventArgs(moveAction);

            ActionPerformed?.Invoke(this, moveActionEventArgs);
        }
Exemplo n.º 5
0
 public void OnActionPerformed(string logMessage)
 {
     ActionPerformed?.Invoke(this, new ActionEventArgs()
     {
         LogMessage = logMessage
     });
 }
Exemplo n.º 6
0
        /// <summary>
        /// Handles <see cref="IActionHandler.HandleAction"/> and raises the <see cref="ActionPerformed"/> event.
        /// </summary>
        /// <param name="actionContext"></param>
        public void HandleAction(IActionContext actionContext)
        {
            var action    = actionContext.Action;
            var parameter = actionContext.ActionParameter;

            OnAction(action, parameter);
            ActionPerformed?.Invoke(this, new ActionEventArgs(actionContext));
        }
Exemplo n.º 7
0
        public void SetConnection(ElementsConnectionViewModel connection)
        {
            connection.ElementDeleted += Connection_ElementDeleted;
            GenericAddedAction <BaseElementViewModel> addedAction = new GenericAddedAction <BaseElementViewModel>(Document, connection);
            var addedActionArgs = new ActionPerformedEventArgs(addedAction);

            ActionPerformed?.Invoke(this, addedActionArgs);
            _activeConnections.Add(connection);
        }
Exemplo n.º 8
0
        public object Execute(IAction action)
        {
            _undoActionStack.Push(action);
            _redoActionStack.Clear();
            object result = action.Do();

            ActionPerformed?.Invoke(this, EventArgs.Empty);
            return(result);
        }
Exemplo n.º 9
0
 public AuditLog(string entityType, Guid?entityId, string executingUserId, ActionPerformed action)
 {
     Id              = Guid.NewGuid();
     OperationDate   = DateTime.Today.Date;
     EntityType      = entityType;
     EntityId        = entityId;
     ExecutingUserId = executingUserId;
     Action          = action;
 }
Exemplo n.º 10
0
        public void ResizeStop()
        {
            Size    newSize         = new Size(Width, Height);
            Point   newPos          = new Point(Left, Top);
            Rect    newRect         = new Rect(newPos, newSize);
            IAction actionPerformed = new ElementResizeAction(this, _lastSize, newRect);
            ActionPerformedEventArgs actionPerformedEventArgs = new ActionPerformedEventArgs(actionPerformed);

            ActionPerformed?.Invoke(this, actionPerformedEventArgs);
        }
Exemplo n.º 11
0
 public void Redo()
 {
     if (_redoActionStack.Count > 0)
     {
         IAction action = _redoActionStack.Pop();
         if (action != null)
         {
             _undoActionStack.Push(action);
             action.Do();
             ActionPerformed?.Invoke(this, EventArgs.Empty);
             Logger.LogInfo("Redo :{action.Description}");
         }
     }
 }
Exemplo n.º 12
0
        /// <summary>
        /// Выполнение действия при сканировании. Добавление/удаление письма из коробки
        /// </summary>
        /// <param name="boxId">Идентификатор коробки</param>
        /// <param name="barCode">Просканированный код</param>
        /// <param name="action">Действие</param>
        public static void DoWork(string boxId, string barCode, ActionPerformed action)
        {
            IsWorking = true;
            var decodedBarCode = BarCodeDecoder.Reconstitute(barCode);
            var contractId     = decodedBarCode.Key;
            var contractNumber = decodedBarCode.Value;

            if (action == ActionPerformed.PutInBox)
            {
                AddContract(boxId, contractId, contractNumber);
            }
            else
            {
                DeleteContract(boxId, contractId);
            }
            Thread.Sleep(50);
            UpdateBox(boxId);
            IsWorking = false;
        }
Exemplo n.º 13
0
 /// <summary>
 /// Creates a button group.
 /// </summary>
 public ButtonGroup() 
 {
     group = new List<ToggleButton>();
     handler = ManageGroup;
 }
Exemplo n.º 14
0
 public void RaiseActionPerformedEvent(object sender, string result)
 {
     ActionPerformed?.Invoke(this, result);
 }
Exemplo n.º 15
0
        public void Initialize(Scene scene, ActionPerformed gameListener, ActionPerformed modeListener)
        {
            // Create the main panel which holds all other GUI components
            frame                  = new G2DPanel();
            frame.Bounds           = new Rectangle(30, 305, 480, 280);
            frame.Border           = GoblinEnums.BorderFactory.LineBorder;
            frame.Transparency     = 0.7f; // Ranges from 0 (fully transparent) to 1 (fully opaque)
            frame.TextTransparency = 1.0f;

            uiFont = State.Content.Load <SpriteFont>("UIFont");

            G2DLabel gameLabel = new G2DLabel("Game Mode:");

            gameLabel.TextFont = uiFont;
            gameLabel.Bounds   = new Rectangle(4, 4, 100, 48);

            // Create radio buttons for selecting the game mode
            gameAdd          = new G2DRadioButton("Add");
            gameAdd.TextFont = uiFont;
            gameAdd.Bounds   = new Rectangle(18, 70, 150, 50);
            // Make the Addition mode as the selected one first
            gameAdd.DoClick();

            gameEdit          = new G2DRadioButton("Edit");
            gameEdit.TextFont = uiFont;
            gameEdit.Bounds   = new Rectangle(170, 70, 150, 50);

            gamePlay          = new G2DRadioButton("Play");
            gamePlay.TextFont = uiFont;
            gamePlay.Bounds   = new Rectangle(310, 70, 150, 50);

            ButtonGroup gameGroup = new ButtonGroup();

            gameGroup.Add(gameAdd);
            gameGroup.Add(gameEdit);
            gameGroup.Add(gamePlay);
            gameGroup.AddActionPerformedHandler(gameListener);

            frame.AddChild(gameLabel);
            frame.AddChild(gameAdd);
            frame.AddChild(gameEdit);
            frame.AddChild(gamePlay);

            G2DSeparator separator1 = new G2DSeparator();

            separator1.Bounds = new Rectangle(5, 129, 470, 5);

            frame.AddChild(separator1);

            modeLabel          = new G2DLabel("Add Mode:");
            modeLabel.TextFont = uiFont;
            modeLabel.Bounds   = new Rectangle(4, 140, 100, 48);

            modeRadio1          = new G2DRadioButton("Single");
            modeRadio1.TextFont = uiFont;
            modeRadio1.Bounds   = new Rectangle(20, 206, 200, 50);
            modeRadio1.DoClick();

            modeRadio2          = new G2DRadioButton("Line");
            modeRadio2.TextFont = uiFont;
            modeRadio2.Bounds   = new Rectangle(220, 206, 250, 50);

            ButtonGroup addGroup = new ButtonGroup();

            addGroup.Add(modeRadio1);
            addGroup.Add(modeRadio2);
            addGroup.AddActionPerformedHandler(modeListener);

            frame.AddChild(modeLabel);
            frame.AddChild(modeRadio1);
            frame.AddChild(modeRadio2);

            // Initially, make the GUI panel invisible
            frame.Visible = false;
            frame.Enabled = false;

            scene.UIRenderer.Add2DComponent(frame);
        }
Exemplo n.º 16
0
        public IList <AuditLog> GetLogsPerUserForAnAction(string userId, DateTime fromDate, DateTime toDate, string entityType, ActionPerformed action)
        {
            IList <AuditLog> auditLogs;

            using (DocSystDbContext context = new DocSystDbContext())
            {
                auditLogs = context.AuditLogs.Where(auditLogDb => auditLogDb.EntityType == entityType)
                            .Where(auditLogDb => auditLogDb.OperationDate >= fromDate)
                            .Where(auditLogDb => auditLogDb.OperationDate <= toDate)
                            .Where(auditLogDb => auditLogDb.ExecutingUserId == userId)
                            .Where(AuditLogDb => AuditLogDb.Action == action).ToList();
            }
            return(auditLogs);
        }
Exemplo n.º 17
0
        protected void NotifyActionPerformed(IAction action)
        {
            ActionPerformedEventArgs eventArgs = new ActionPerformedEventArgs(action);

            ActionPerformed?.Invoke(this, eventArgs);
        }
Exemplo n.º 18
0
 private void OnActionPerformed(object sender, EventArgs e)
 {
     ActionPerformed?.Invoke(this, e);
     IsModified = true;
     Modified?.Invoke(this, IsModified);
 }
Exemplo n.º 19
0
 public void HandleAction(object model, string action, object parameter)
 {
     OnAction(action, parameter);
     ActionPerformed?.Invoke(this, new ActionEventArgs(action));
 }
 public BehaviorEvent(ActionPerformed actionPerformed)
     : base(actionPerformed.UserId)
 {
     _actionPerformed = actionPerformed;
 }
        public void CreateLog(string entityType, Guid?entityId, string executingUserId, ActionPerformed action)
        {
            AuditLog logEvent = new AuditLog(entityType, entityId, executingUserId, action);

            AuditLogDataAccess.Add(logEvent);
        }
Exemplo n.º 22
0
 public virtual void PerformPlayerAction(PlayedEventArgs args)
 {
     ActionPerformed?.Invoke(this, args);
 }
        public Dictionary <string, int> GetLogsPerUserForAnAction(IList <string> usersId, DateTime fromDate, DateTime toDate, string entityType, ActionPerformed action)
        {
            Dictionary <string, int> entitiesActionedByUser = new Dictionary <string, int>();

            foreach (string id in usersId)
            {
                IList <AuditLog> logsByOneUser = AuditLogDataAccess.GetLogsPerUserForAnAction(id, fromDate, toDate, entityType, action);
                entitiesActionedByUser.Add(id, logsByOneUser.Count);
            }

            return(entitiesActionedByUser);
        }
        private void btnAddStaff_Click(object sender, EventArgs e)
        {
            if (txtFirstName.isEmptyOrHint())
            {
                txtFirstName.Focus();
                return;
            }
            if (txtLastName.isEmptyOrHint())
            {
                txtLastName.Focus();
                return;
            }
            if (txtAddress1.isEmptyOrHint())
            {
                txtAddress1.Focus();
                return;
            }
            if (txtAddress2.isEmptyOrHint())
            {
                txtAddress2.Focus();
                return;
            }

            if (txtCity.isEmptyOrHint())
            {
                txtCity.Focus();
                return;
            }

            if (txtCountry.isEmptyOrHint())
            {
                txtCountry.Focus();
                return;
            }

            if (txtPostalCode.isEmptyOrHint())
            {
                txtPostalCode.Focus();
                return;
            }

            if (txtPhoneNumber.isEmptyOrHint())
            {
                txtPhoneNumber.Focus();
                return;
            }
            if (txtQualification.isEmptyOrHint())
            {
                txtQualification.Focus();
                return;
            }
            Staff newStaff = new Staff()
            {
                FirstName     = txtFirstName.Text.Trim(),
                LastName      = txtLastName.Text.Trim(),
                Address1      = txtAddress1.Text.Trim(),
                Address2      = txtAddress2.Text.Trim(),
                City          = txtCity.Text.Trim(),
                Country       = txtCountry.Text.Trim(),
                PostalCode    = txtPostalCode.Text.Trim(),
                PhoneNumber   = txtPhoneNumber.Text.Trim(),
                Qualification = txtQualification.Text.Trim(),
                Password      = txtPassword.Text.Trim(),
                Username      = txtUsername.Text.Trim(),
            };

            if (_isUpdate)
            {
                if (_updatedStaff == null)
                {
                    MessageBox.Show("Error in system!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                newStaff.Id = _updatedStaff.Id;
                int res = _sr.UpdateStaff(newStaff);

                if (res < 0)
                {
                    MessageBox.Show("Error In Update!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    ActionPerformed?.Invoke(newStaff, ActionType.Updated);
                    Hide();
                }
            }
            else
            {
                int res = _sr.AddStaffMember(newStaff);
                if (res < 0)
                {
                    MessageBox.Show("Error In Adding New Staff!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    newStaff.Id = res;
                    ActionPerformed?.Invoke(newStaff, ActionType.Added);
                    Hide();
                }
            }
            Clear();
        }
Exemplo n.º 25
0
 /// <summary>
 /// Creates a button group.
 /// </summary>
 public ButtonGroup()
 {
     group   = new List <ToggleButton>();
     handler = ManageGroup;
 }
Exemplo n.º 26
0
 protected virtual void OnActionPerformed(CharacterController2D sender, OnActionEventArgs action)
 {
     ActionPerformed?.Invoke(sender, action);
 }
Exemplo n.º 27
0
 /// <summary>
 /// Adds a ActionPerformed callback function to all of the group buttons.
 /// </summary>
 /// <param name="callback"></param>
 public virtual void AddActionPerformedHandler(ActionPerformed callback)
 {
     foreach (ToggleButton button in group)
         button.ActionPerformedEvent += callback;
 }