コード例 #1
0
        public MainViewModel()
        {
            m_NewCommand                      = new CommandHandler <string>(__New, true);
            m_OpenCommand                     = new CommandHandler(__Open, true);
            m_SaveCommand                     = new CommandHandler(__Save, false);
            m_SaveAsCommand                   = new CommandHandler(__SaveAs, false);
            m_SettingsCommand                 = new CommandHandler(__Settings, true);
            m_EstwOnlineCommand               = new CommandHandler(__StartEstwOnline, true);
            m_ExitCommand                     = new CommandHandler(__Exit, true);
            m_EstwSelectionCommand            = new CommandHandler(__ShowEstwSelectionWindow, false);
            m_TrainProgressInformationCommand = new CommandHandler(__ShowTrainProgressInformationWindow, false);
            m_TimeTableCommand                = new CommandHandler <Station>(__ShowTimeTableWindow, true);
            m_TrainScheduleCommand            = new CommandHandler(__ShowTrainScheduleWindow, false);
            m_SystemStateCommand              = new CommandHandler(__ShowSystemStateWindow, false);
            m_SaveLayoutCommand               = new CommandHandler(__SaveLayout, true);
            m_ClearChildWindowsCommand        = new CommandHandler(__ClearChildWindows, true);
            m_ShowHelpCommand                 = new CommandHandler(__ShowHelp, true);
            m_ShowQuickStartHelpCommand       = new CommandHandler(__ShowQuickStartHelp, true);
            m_AboutCommand                    = new CommandHandler(__ShowAboutWindow, true);
            m_DebugModeCommand                = new CommandHandler(__ToggleDebugMode, true);

            m_InitializationBll = new InitializationBLL();
            m_LiveDataBll       = new LiveDataBLL();
            m_SettingsBll       = new SettingsBLL();
            m_SerializationBll  = new SerializationBLL();

            m_ChildViewModels = new List <ViewModelBase>();
            ChildWindows      = new ObservableCollection <ChildWindow>();

            Runtime.VisibleStationsChanged += __VisibleStationsChanged;

            var AreaResult = m_InitializationBll.GetAreaInformation();

            if (AreaResult.Succeeded)
            {
                Areas = AreaResult.Result.ToObservableCollection();
            }
            else
            {
                ShowMessage(AreaResult);
                Areas = new ObservableCollection <Area>();
            }

            var SettingsResult = m_SettingsBll.AreSettingsComplete();

            if (SettingsResult.Succeeded)
            {
                if (!SettingsResult.Result)
                {
                    __Settings();
                }
            }
            else
            {
                ShowMessage(SettingsResult);
            }

            StatusBarText = "Herzlich willkommen!";
        }