Esempio n. 1
0
        private async Task EndOutage()
        {
            var outageElementId = SelectedOutage.OutageElement.GID;

            var outageSimulatorUIClient = OutageSimulatorUIClient.CreateClient();

            if (await outageSimulatorUIClient.EndOutage(outageElementId))
            {
                if (!activeOutagesMap.ContainsKey(outageElementId))
                {
                    return;
                }

                ActiveOutageBindingModel outage = activeOutagesMap[outageElementId];
                ActiveOutages.Remove(outage);
                activeOutagesMap.Remove(outageElementId);

                OnPropertyChanged("ActiveOutages");
                OnPropertyChanged("SelectedOutage");
                OnPropertyChanged("IsSelectedOutageGridVisible");
                OnPropertyChanged("OutageElement");
                OnPropertyChanged("OptimumIsolationPoints");
                OnPropertyChanged("DefaultIsolationPoints");
            }
        }
        private async Task OverviewSelection()
        {
            var outageSimulatorUIClient = OutageSimulatorUIClient.CreateClient();
            var simulatedOutages        = await outageSimulatorUIClient.GetAllSimulatedOutages();

            this.overview.SetOutages(simulatedOutages);
        }
Esempio n. 3
0
        private async Task GenerateOutageLogic()
        {
            if (!(OutageElement.Count == 1 && OptimumIsolationPoints.Count > 0 && DefaultIsolationPoints.Count > 0))
            {
                string message = $"Rules: OutageElement.Count == 1 && OptimumIsolationPoints.Count > 0 && DefaultIsolationPoints.Count > 0";
                MessageBox.Show(message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            var outage = new SimulatedOutage();

            outage.OutageElementGid = OutageElement.First().GID;
            outage.OptimumIsolationPointGids.AddRange(OptimumIsolationPoints.Select(point => point.GID));
            outage.DefaultIsolationPointGids.AddRange(DefaultIsolationPoints.Select(point => point.GID));

            for (int i = 0; i < DefaultIsolationPoints.Count; i++)
            {
                if (!outage.DefaultToOptimumIsolationPointMap.ContainsKey(DefaultIsolationPoints[i].GID) && i < OptimumIsolationPoints.Count)
                {
                    outage.DefaultToOptimumIsolationPointMap.Add(DefaultIsolationPoints[i].GID, OptimumIsolationPoints[i].GID);
                }
            }

            var outageSimulatorUIClient = OutageSimulatorUIClient.CreateClient();
            await outageSimulatorUIClient.GenerateOutage(outage);

            await parentWindow.ChangeTab(TabType.OVERVIEW);

            OutageElement.Clear();
            outageElementGids.Clear();
            OptimumIsolationPoints.Clear();
            optimumIsolationPointsGids.Clear();
            DefaultIsolationPoints.Clear();
            defaultIsolationPointsGids.Clear();

            SetGenerateOutageIsEnabled();
            SetSelectOutageElementIsEnabled();
            SetDeselectOutageElementIsEnabled();
            SetAddOptimumIsolationPointIsEnabled();
            SetRemoveOptimumIsolationPointIsEnabled();
            SetAddDefaultIsolationPointIsEnabled();
            SetRemoveDefaultIsolationPointIsEnabled();
            //OnPropertyChanged("IsGenerateOutageEnabled");
            //OnPropertyChanged("IsSelectOutageElementEnabled");
            //OnPropertyChanged("IsDeSelectOutageElementEnabled");
            //OnPropertyChanged("IsAddOptimumIsolationPointEnabled");
            //OnPropertyChanged("IsRemoveOptimumIsolationPointEnabled");
            //OnPropertyChanged("IsAddDefaultIsolationPointEnabled");
            //OnPropertyChanged("IsRemoveDefaultIsolationPointEnabled");
        }