public MainShellViewModel()
        {
            TopMenu = new ObservableCollection <UserControl>();
            TopMenu.Add(new TopMenu());

            //subscriber = new Subscriber();
            //subscriber.Subscribe();
            //subscriber.publishCrewEvent += GetCrewUpdate;
            //subscriber.publishIncident += GetIncident;
            //subscriber.publishCall += GetCallFromConsumers;
            //subscriber.publiesBreakers += SearchForIncident;

            dMSProxy = new ClientDMSProxy();

            try
            {
                List <Source> sourcesList = dMSProxy.GetAllSources();
            }
            catch (Exception e) { }

            try
            {
                List <IncidentReport> reportsList = iMSProxy.GetAllReports();
            }
            catch (Exception e) { }
        }
示例#2
0
        public void GetAllSources()
        {
            this.Sources = new ObservableCollection <Button>();

            foreach (Source source in LocalCache.Sources.Values)
            {
                Button but = new Button()
                {
                    Content = source.MRID, DataContext = this, Command = OpenNetworkViewCommand, CommandParameter = source.MRID
                };
                this.Sources.Add(but);
            }

            List <Source> sourcesList = new List <Source>();

            try
            {
                sourcesList = cgProxy.GetAllSources();
            }
            catch (Exception e)
            {
                return;
            }

            foreach (Source source in sourcesList)
            {
                if (!LocalCache.Sources.TryGetValue(source.MRID, out Source source1))
                {
                    LocalCache.Sources.Add(source.MRID, source);

                    Button but = new Button()
                    {
                        Content = source.MRID, DataContext = this, Command = OpenNetworkViewCommand, CommandParameter = source.MRID
                    };
                    but.Style = ((Style)frameworkElement.FindResource("ButtonStyle"));
                    this.Sources.Add(but);
                }
            }
        }