Exemplo n.º 1
0
        //Acc End IA
        private void OnSelectedSystemTab(SystemBase system)
        {
            LeftSideBarChild toSelect = AllSystems.FirstOrDefault(a => a.Children.FirstOrDefault(b => b.Source.Id == system.Id) != null)?.Children.FirstOrDefault(b => b.Source.Id == system.Id);

            if (toSelect != null)
            {
                toSelect.IsSelected = true;
            }
        }
    void Start()
    {
        // get a reference to the contexts
        var contexts = Contexts.sharedInstance;

        contexts.game.SetUiRoot(canvas);
        _systems = AllSystems.Get(contexts);


        // call Initialize() on all of the IInitializeSystems
        _systems.Initialize();
    }
Exemplo n.º 3
0
        private void SelectedTreeViewItemClick(object leftSideBarChild)
        {
            if (leftSideBarChild.GetType().Equals(typeof(LeftSideBarChild)))
            {
                var object2 = ((LeftSideBarChild)leftSideBarChild).Source;

                var vrf = WorkFlowContext.CurrentSystem as JCHVRF.Model.NextGen.SystemVRF;
                if (vrf != null && vrf.HvacSystemType == "1")
                {
                    if ((vrf.MyPipingOrphanNodes != null && vrf.MyPipingOrphanNodes.Count > 0) || (vrf.SystemStatus == SystemStatus.WIP && vrf.IsManualPiping))
                    {
                        JCHMessageBox.Show(Langauge.Current.GetMessage("ALERT_CHANGES_CANVAS"));
                        LeftSideBarChild toselect = AllSystems?.FirstOrDefault(a => a.Children.Count > 0 && a.Children.FirstOrDefault(b => ((SystemBase)b.Source)?.Id == _lastSelectedId) != null)?.Children.FirstOrDefault(b => ((SystemBase)b.Source)?.Id == _lastSelectedId);
                        if (toselect != null)
                        {
                            toselect.IsSelected = true;
                        }
                        else
                        {
                            toselect            = AllSystems?.FirstOrDefault(a => a.Children.Count > 0 && a.Children.FirstOrDefault() != null)?.Children.FirstOrDefault();
                            toselect.IsSelected = true;
                        }
                        return;
                    }
                    //Start Bug#4695 : If ODU is dirty then get confirmation before user leaves the current system. Retain user on the same system if he wants to stay.
                    else if (vrf.IsODUDirty)
                    {
                        MessageBoxResult messageBoxResult = JCHMessageBox.Show(Langauge.Current.GetMessage("ALERT_CHANGES_ON_SYSTEM_FLIP"), MessageType.Warning, MessageBoxButton.YesNo);

                        if (messageBoxResult == MessageBoxResult.Yes)
                        {
                            LeftSideBarChild toselect = AllSystems?.FirstOrDefault(a => a.Children.Count > 0 && a.Children.FirstOrDefault(b => ((SystemBase)b.Source)?.Id == _lastSelectedId) != null)?.Children.FirstOrDefault(b => ((SystemBase)b.Source)?.Id == _lastSelectedId);
                            if (toselect != null)
                            {
                                toselect.IsSelected = true;
                            }
                            else
                            {
                                toselect            = AllSystems?.FirstOrDefault(a => a.Children.Count > 0 && a.Children.FirstOrDefault() != null)?.Children.FirstOrDefault();
                                toselect.IsSelected = true;
                            }
                            return;
                        }
                    }
                    //End Bug#4695
                }


                _eventAggregator.GetEvent <SystemSelectedItemSubscriber>().Publish((SystemBase)object2);
                _lastSelectedId = ((SystemBase)object2).Id;
            }
        }
Exemplo n.º 4
0
        public Game()
            : base()
        {
            // Graphics.
            this.graphics = new GraphicsDeviceManager(this);
            this.graphics.PreferredBackBufferWidth  = 640;
            this.graphics.PreferredBackBufferHeight = 480;

            // Content.
            this.Content.RootDirectory = "Content";

            // World.
            this.world = new EntityWorld();
            AllSystems.AddSystems(this.world);
        }
Exemplo n.º 5
0
        private void OnLoadedChanged(string state)
        {
            if (state == "Loaded")
            {
                fromLoad = false;
                if (!_isLoadedOnce)
                {
                    Project.GetProjectInstance.SelectedSystemID = string.Empty;
                    RefreshSystemsList();

                    LeftSideBarItem  sideBarItem = AllSystems.FirstOrDefault(a => a.Children.Count > 0);
                    LeftSideBarChild first       = sideBarItem != null ? sideBarItem.Children[0] : null;

                    if (first != null)
                    {
                        if (firstInstance)
                        {
                            first.IsSelected = true;
                            first.IsEditable = false;
                            _eventAggregator.GetEvent <SystemSelectedItemSubscriber>().Publish((SystemBase)first.Source);
                            firstInstance = false;
                        }
                        else
                        {
                            SystemBase selectedSystem = WorkFlowContext.CurrentSystem;
                            foreach (LeftSideBarItem item in AllSystems)
                            {
                                foreach (LeftSideBarChild child in item.Children)
                                {
                                    if (child.Source.Equals(selectedSystem))
                                    {
                                        child.IsSelected = true;
                                        _eventAggregator.GetEvent <SystemSelectedItemSubscriber>().Publish(selectedSystem);
                                    }
                                }
                            }
                        }
                    }
                }
                _isLoadedOnce = true;
            }
            else
            {
            }
            fromLoad = true;
        }
Exemplo n.º 6
0
        void filterSystemList()
        {
            AllSystems = null;

            if (Project.GetProjectInstance?.SystemListNextGen != null)
            {
                foreach (SystemBase system in Project.GetProjectInstance.SystemListNextGen)
                {
                    if (ContainsSearchText(system))
                    {
                        AllSystems[0].Children.Add(new LeftSideBarChild(system.Name, AllSystems[0].Header, system.StatusIcon, system));
                    }
                }
            }
            if (Project.GetProjectInstance?.HeatExchangerSystems != null)
            {
                foreach (SystemBase system in Project.GetProjectInstance.HeatExchangerSystems)
                {
                    if (ContainsSearchText(system))
                    {
                        AllSystems[1].Children.Add(new LeftSideBarChild(system.Name, AllSystems[0].Header, system.StatusIcon, system));
                    }
                }
            }

            if (Project.GetProjectInstance?.ControlSystemList != null)
            {
                foreach (SystemBase system in Project.GetProjectInstance.ControlSystemList)
                {
                    if (ContainsSearchText(system))
                    {
                        AllSystems[2].Children.Add(new LeftSideBarChild(system.Name, AllSystems[0].Header, system.StatusIcon, system));
                    }
                }
            }
            if (AllSystems != null && AllSystems.Count > 0)
            {
                LeftSideBarItem  sideBarItem = AllSystems.FirstOrDefault(a => a.Children.Count > 0);
                LeftSideBarChild first       = sideBarItem != null ? sideBarItem.Children[0] : null;
                if (first != null)
                {
                    first.IsSelected = true;
                    _eventAggregator.GetEvent <SystemSelectedItemSubscriber>().Publish((SystemBase)first.Source);
                }
            }
        }
Exemplo n.º 7
0
        public void RefreshSystemsList()
        {
            AllSystems = null;

            if (Project.GetProjectInstance?.SystemListNextGen != null)
            {
                foreach (SystemBase system in Project.GetProjectInstance.SystemListNextGen)
                {
                    if (ContainsSearchText(system))
                    {
                        AllSystems[0].Children.Add(new LeftSideBarChild(system.Name, AllSystems[0].Header, system.StatusIcon, system));
                    }
                }
            }
            if (Project.GetProjectInstance?.HeatExchangerSystems != null)
            {
                foreach (SystemBase system in Project.GetProjectInstance.HeatExchangerSystems)
                {
                    if (ContainsSearchText(system))
                    {
                        AllSystems[1].Children.Add(new LeftSideBarChild(system.Name, AllSystems[0].Header, system.StatusIcon, system));
                    }
                }
            }

            if (Project.GetProjectInstance?.ControlSystemList != null)
            {
                foreach (SystemBase system in Project.GetProjectInstance.ControlSystemList)
                {
                    if (ContainsSearchText(system))
                    {
                        AllSystems[2].Children.Add(new LeftSideBarChild(system.Name, AllSystems[0].Header, system.StatusIcon, system));
                    }
                }
            }
            //RaisePropertyChanged("AllSystems");
            if (fromLoad == true)
            {
                _lastSelectedId = Project.CurrentProject.SelectedSystemID;
                if (!string.IsNullOrEmpty(_lastSelectedId))
                {
                    LeftSideBarChild toselect = AllSystems?.FirstOrDefault(a => a.Children.Count > 0 && a.Children.FirstOrDefault(b => ((SystemBase)b.Source)?.Id == _lastSelectedId) != null)?.Children.FirstOrDefault(b => ((SystemBase)b.Source)?.Id == _lastSelectedId);
                    if (toselect != null)
                    {
                        toselect.IsSelected = true;
                        if (isEditable.HasValue)
                        {
                            toselect.IsEditable = isEditable.Value;
                            //toselect.IsEditable = false;
                        }
                        if (isSideBarVisible.HasValue)
                        {
                            toselect.IsSideBarVisible = isSideBarVisible.Value;
                        }
                        _eventAggregator.GetEvent <SystemSelectedItemSubscriber>().Publish((SystemBase)toselect.Source);
                    }
                }
                else
                {
                    LeftSideBarItem  sideBarItem = AllSystems.FirstOrDefault(a => a.Children.Count > 0);
                    LeftSideBarChild first       = sideBarItem != null ? sideBarItem.Children[0] : null;
                    if (first != null)
                    {
                        first.IsSelected = true;
                        if (isEditable.HasValue)
                        {
                            first.IsEditable = isEditable.Value;
                        }
                        if (isSideBarVisible.HasValue)
                        {
                            first.IsSideBarVisible = isSideBarVisible.Value;
                        }
                        _eventAggregator.GetEvent <SystemSelectedItemSubscriber>().Publish((SystemBase)first.Source);
                    }
                }
            }
        }