Esempio n. 1
0
        public ShellViewModel(ILoggerFacade logger, ICoordinator coordinator, IRegionManager regionManager, IShell shell)
        {
            Logger        = logger;
            RegionManager = regionManager;
            Coordinator   = coordinator;
            Shell         = shell;

            MoveCommand          = new DelegateCommand(OnMoveWindow);
            MinimizeCommand      = new DelegateCommand(OnMinimize);
            CloseCommand         = new DelegateCommand(OnClose);
            ImageDoubleCommand   = new DelegateCommand(OnNavigateToAbout);
            OpenMenuCommand      = new DelegateCommand <object>(OnOpenMenu);
            LoadContestCommand   = new DelegateCommand(OnLoadContest);
            SaveContestCommand   = new DelegateCommand(OnSaveContest);
            SaveContestAsCommand = new DelegateCommand(OnSaveContestAs);
            StartOverCommand     = new DelegateCommand(OnStartOver);

            UIHelper.ViewChanged += (s, e) => RaisePropertyChanged("MenuActive");

            Core.DisplayRequested += (s, e) =>
            {
                Shell.Activate();
                Shell.WindowState = WindowState.Normal;
            };

            if (Core.Load)
            {
                Load(Core.LoadPath);
            }
            Core.LoadRequested += (s, e) => Load(e);
        }
Esempio n. 2
0
 public void OpenMainWindow()
 {
     if (CanOpenMainWindow())
     {
         if (mainWindow == null)
         {
             var mainWindowFactory = shellFactories.Single(s => s.Metadata.ShellUse == "Main window");
             var context           = mainWindowFactory.CreateExport();
             mainWindow = context.Value;
             ShowMainWindow();
         }
         else
         {
             if (!mainWindow.IsLoaded)
             {
                 ShowMainWindow();
             }
             else
             {
                 mainWindow.Activate();
             }
         }
     }
 }