private void BeginSelectScenario()
 {
     SelectScenarioView.Show(_scenarioId, (selectedScenarioId) => {
         _scenarioId = selectedScenarioId;
         Refresh();
     });
 }
Example #2
0
 private void BeginSelectScenarios()
 {
     SelectScenarioView.Show(_diagramsScenariosViews, (newScenarios) => {
         _diagramsScenariosViews = newScenarios;
         SaveData();
         InitiateReload();
     });
 }
Example #3
0
 public static void UserInitialize(Action <bool> callback, IAction action, ValueTypeBase valueType, bool inheritsSupportedValues, IAction masterAction)
 {
     if (action is IStandardValueAction standardVTAction)
     {
         IStandardVTActionEditView vtAction = CreateControl(standardVTAction, masterAction);
         if (vtAction == null)
         {
             callback?.Invoke(true);
         }
         var dialog = new DialogView((FrameworkElement)vtAction);
         vtAction.ApplyClicked += () =>
         {
             callback(true);
             dialog.Close();
         };
         dialog.Show();
     }
     else if (action is RunExistingScenarioAction runExistingScenAction)
     {
         var runExistingScenarioAction = runExistingScenAction;
         SelectScenarioAndRunModeView.Show(
             (selectedScenario, selectedMode) => {
             var id = selectedScenario.Id;
             runExistingScenarioAction.Mode             = selectedMode;
             runExistingScenarioAction.TargetScenarioId = id;
             runExistingScenarioAction.SetTargetScenario(selectedScenario);
             callback(true);
         },
             valueType?.GetType(),
             Lazurite.Windows.Modules.ActionInstanceSide.OnlyLeft,
             runExistingScenarioAction.TargetScenarioId,
             runExistingScenarioAction.Mode);
     }
     else if (action is GetExistingScenarioValueAction getScenarioValueAction)
     {
         SelectScenarioView.Show(
             (selectedScenario) => {
             var id = selectedScenario.Id;
             getScenarioValueAction.TargetScenarioId = id;
             getScenarioValueAction.SetTargetScenario(selectedScenario);
             callback(true);
         },
             valueType?.GetType(),
             Lazurite.Windows.Modules.ActionInstanceSide.OnlyRight,
             getScenarioValueAction.TargetScenarioId);
     }
     else
     {
         callback(action.UserInitializeWith(valueType, inheritsSupportedValues));
     }
 }
        public GeolocationView()
        {
            InitializeComponent();

            DialogView.DialogOpened += DialogView_DialogOpened;
            DialogView.DialogClosed += DialogView_DialogClosed;

            locationsView.ScenarioSelectClicked += (o, e) => {
                SelectScenarioView.Show(
                    _scenarioIds,
                    (newScenarioIds) => {
                    _scenarioIds = newScenarioIds;
                    NeedItems?.Invoke(new StatisticsFilter()
                    {
                        ScenariosIds = newScenarioIds
                    });
                });
            };

            Loaded += async(o, e) =>
            {
                var geolocationScenarios = ScenariosRepository
                                           .Scenarios
                                           .Where(x => x.ValueType is GeolocationValueType)
                                           .ToArray();

                var registrationInfo = await StatisticsManager.GetRegistrationInfo(geolocationScenarios);

                _scenarioIds = registrationInfo.RegisteredIds;

                NeedItems?.Invoke(
                    new StatisticsFilter()
                {
                    ScenariosIds = _scenarioIds
                });
            };

            Unloaded += (o, e) => Dispose();
        }