Esempio n. 1
0
 private void OnFactoryReset(object sender, BooleanEventArgs e)
 {
     if (!e.Value)
     {
         this.UpdateIp(null, new StringEventArgs(null));
     }
     this.PlcEvents.Pause();
     //this.OnMainThread(new Action(this.TryDisconnect));
     //this.OnMainThread(() => this.HardwareConfig.ResetConfiguration(IWorkingContextExtension.GetDlc<ICommandProcessor>(this.WorkingContext, (string)null)));
     this.PlcEvents.Resume();
 }
Esempio n. 2
0
 private void _worker_SaveTableEnabled(object sender, BooleanEventArgs e)
 {
     try
     {
         EnableToolStripItems(e.Value, toolStripButtonStandardSaveTable, toolStripMenuItemMainTableSave);
     }
     catch (Exception ex)
     {
         _worker.ShowError(ex);
     }
 }
    // In the event of a robot attack, I want to tell the player who was killed. That's why the event this
    // function is listening to exists, and this function call is a middleman between statusUI and GameOverUI.
    //
    // StatusUI says "Ok, I rolled a robot attack. Colonist Manager, tell us who was killed?" and it calls the
    // roboAttack event. This function figures out a random colonist based on its lists, and then it says
    // "So I know who died, now someone put this on the screen" and when it calls RoboAttackUI it gives up the
    // lucky colonist.
    //
    // However, sometimes no one dies in a roboAttack, so ColonistManager also sends a boolean
    // that tells this function whether or not anyone was killed. If no one was killed this function still opens
    // the UI but it tells GameOverUI there was no casualty by sending null instead of a colonist. Apologies for the
    // novel but this is one of the more convoluted implementations so I wanted to make it clear what's happening.
    void OnRoboAttack(object sender, BooleanEventArgs args)
    {
        Boolean casualty = args.booleanPayload;

        if (casualty)
        {
            Colonist dead = allColonists[UnityEngine.Random.Range(0, allColonists.Count - 1)];
            GameEvents.InvokeRoboAttackUIStarted(dead);
        }
        else
        {
            GameEvents.InvokeRoboAttackUIStarted(null);
        }
    }
Esempio n. 4
0
 private void GalleryContainer_TreeSelectionChanged(object sender, BooleanEventArgs e)
 {
     try
     {
         if (InvokeRequired)
         {
             Invoke(new EventHandler <BooleanEventArgs>(GalleryContainer_TreeSelectionChanged), new object[] { sender, e });
         }
         else
         {
             toolStripMenuItemSource.Enabled = e.Value;
         }
     }
     catch (Exception ex)
     {
         FormUtilities.ShowError(this, ex);
     }
 }
Esempio n. 5
0
 private void SettingsWorker_UseSpecificOutputFolderUpdated(object sender, BooleanEventArgs e)
 {
     try
     {
         if (InvokeRequired)
         {
             Invoke(new EventHandler <BooleanEventArgs>(SettingsWorker_UseSpecificOutputFolderUpdated), new object[] { sender, e });
         }
         else
         {
             _discardEvents = true;
             checkBoxUseSpecificOutputFolder.Checked = e.Value;
             _discardEvents = false;
             textBoxOutputFolder.Enabled      = e.Value;
             buttonBrowseOutputFolder.Enabled = e.Value;
         }
     }
     catch (Exception ex)
     {
         FormUtilities.ShowError(this, ex);
     }
 }
Esempio n. 6
0
 private void MotorAvailable(object sender, BooleanEventArgs e)
 {
     Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
                                                                                      motor = e.Value));
     parentModule.Log("Motor available: " + e.Value);
 }
Esempio n. 7
0
 private void RunningChanged(object sender, BooleanEventArgs e)
 {
     Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
                                                                                      btnStop.IsEnabled = e.Value));
 }
Esempio n. 8
0
 /// <summary>
 /// the Event on Services availability changed.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">if set to <c>true</c> [e].</param>
 private void ServicesAvailabilityChanged(object sender, BooleanEventArgs e)
 {
     DIContainer.Instance.Resolve<Workstation>().IsServiceAvailable = e.IsOnline;
     SetConnectionMode();
     Messenger.Instance.Notify(MessengerMessage.UpdateNetworkIcon);
 }
Esempio n. 9
0
 public void Switch(object sender, BooleanEventArgs args)
 {
     isActive = !args.ok;
 }
 public SaveCulturePrefCommand(BooleanEventArgs args, UserPreferencesModel preferences, Database database)
 {
     this.args        = args;
     this.preferences = preferences;
     this.database    = database;
 }