示例#1
0
 protected SnapIn()
 {
     this.MessageService = MessageService.Instance;
     this.ShowHelpFunction = () =>
     {
         ShowBusyHandler();
         MessageService.ShowWarningDialog("No Help available", "Help is not yet implemented.", showBusyHandler: false);
         HideBusyHandler();
     };
 }
        private ApplicationViewModel()
        {
            var tempSnapIns = new List<SnapInNames>();

            tempSnapIns.Add(SnapInNames.Main);
            tempSnapIns.Add(SnapInNames.UserControl);
            tempSnapIns.Add(SnapInNames.NFCTag);
            tempSnapIns.Add(SnapInNames.AccessControl);
            tempSnapIns.Add(SnapInNames.Settings);

            this.SnapIns = new Dictionary<SnapInNames,SnapIn>();

            foreach (var snapIn in tempSnapIns)
            {
                var viewModel = CreateSnapIn(snapIn);
                if (viewModel != null)
                   SnapIns.Add(snapIn, viewModel);
            }

            this.HistoryService = HistoryService.Instance;
            this.MessageService = MessageService.Instance;
            this.DataService = DataService.Instance;

            this.MessageService.SetApplicationShell(this);

            try
            {
                this.DataService.SetDataSource(new XmlDataSource());
            }
            catch (Exception e)
            {
                this.MessageService.ShowErrorDialog("Datasource could not be loaded.", e.Message);
            }

            this.RaisePropertyChanged("SnapIns");

            ActivateScreen(SnapInNames.Main);
        }