Exemplo n.º 1
0
        public WIDExportVM(ToolsVM tools, IDialogProvider dialogProvider)
            : base(tools)
        {
            this._dialogProvider = dialogProvider;

            #region Commands

            BrowseCommand = new DelegateCommand(() =>
            {
                string path = _dialogProvider.OpenBrowseDialog();
                Path        = path;
            });

            ExportCommand = new DelegateCommand(async() =>
            {
                await Export();
            },
                                                () => (
                                                    Tools.CurrentProjectCollection != null &&
                                                    (IsAllTeamProjects == true || Tools.CurrentTeamProject != null) &&
                                                    (IsAllWorkItemTypes == true || Tools.CurrentWorkItemType != null) &&
                                                    !string.IsNullOrEmpty(Path)
                                                    )
                                                );

            #endregion
        }
Exemplo n.º 2
0
 public LanguageSettingsViewModel(ILanguageManager languageManager, IDialogProvider dialogProvider)
 {
     _languageManager  = languageManager;
     _dialogProvider   = dialogProvider;
     Languages         = languageManager.GetInstalledLanguages();
     _selectedLanguage = Languages.FirstOrDefault(x => x.Code.Equals(_languageManager.SavedLanguage.Code));
 }
Exemplo n.º 3
0
        public WIDImportVM(ToolsVM tools, IDialogProvider dialogProvider)
            : base(tools)
        {
            this._dialogProvider = dialogProvider;

            #region Commands

            BrowseCommand = new DelegateCommand(() =>
            {
                string fileName = _dialogProvider.OpenFileDialog();
                FileName = fileName;
            });

            ImportCommand = new DelegateCommand(async () =>
            {
                await Import();
            },
            () => (
                Tools.CurrentProjectCollection != null &&
                (IsAllTeamProjects == true || Tools.CurrentTeamProject != null) &&
                !string.IsNullOrEmpty(FileName)
                )
            );

            #endregion
        }
        public CategoriesExportVM(ToolsVM tools, IDialogProvider dialogProvider)
            : base(tools)
        {
            this._dialogProvider = dialogProvider;

            #region Commands

            BrowseCommand = new DelegateCommand(() =>
            {
                string path = dialogProvider.OpenBrowseDialog();
                Path = path;
            });

            ExportCommand = new DelegateCommand(async () =>
            {
                await Export();
            },
            () => (
                Tools.CurrentProjectCollection != null &&
                (IsAllTeamProjects || Tools.CurrentTeamProject != null) &&
                !string.IsNullOrEmpty(Path)
                )
            );

            #endregion
        }
Exemplo n.º 5
0
        public WIDImportVM(ToolsVM tools, IDialogProvider dialogProvider)
            : base(tools)
        {
            this._dialogProvider = dialogProvider;

            #region Commands

            BrowseCommand = new DelegateCommand(() =>
            {
                string fileName = _dialogProvider.OpenFileDialog();
                FileName        = fileName;
            });

            ImportCommand = new DelegateCommand(async() =>
            {
                await Import();
            },
                                                () => (
                                                    Tools.CurrentProjectCollection != null &&
                                                    (IsAllTeamProjects == true || Tools.CurrentTeamProject != null) &&
                                                    !string.IsNullOrEmpty(FileName)
                                                    )
                                                );

            #endregion
        }
Exemplo n.º 6
0
 public void Construct(GameManager gameManager, PlayerMoney playerMoney, IDialogProvider dialogProvider)
 {
     _gameManager   = gameManager;
     _eventDialog   = dialogProvider.GetEventDialog();
     _outcomeDialog = dialogProvider.GetOutcomeDialog();
     _playerMoney   = playerMoney;
 }
Exemplo n.º 7
0
        public MainWindowViewModel(IDialogProvider dialogProvider)
        {
            this.DialogProvider = dialogProvider;

            //
            // Initialize the 'Document Overview' pane view-model.
            //
            this.DocumentOverviewPaneViewModel = new DocumentOverviewPaneViewModel(this);

            //
            // Initialize the 'Open Documents' pane view-model.
            //
            this.OpenDocumentsPaneViewModel = new OpenDocumentsPaneViewModel(this);

            //
            // Add view-models for panes to the 'Panes' collection.
            //
            this.Panes = new ObservableCollection <AbstractPaneViewModel>();
            this.Panes.Add(this.DocumentOverviewPaneViewModel);
            this.Panes.Add(this.OpenDocumentsPaneViewModel);

            //
            // Add an example/test document view-model.
            //
            this.Documents = new ObservableCollection <TextFileDocumentViewModel>();
            this.Documents.Add(new TextFileDocumentViewModel(string.Empty, "test data!", true));
        }
        public MainWindowViewModel(IDialogProvider dialogProvider)
        {
            this.DialogProvider = dialogProvider;

            //
            // Initialize the 'Document Overview' pane view-model.
            //
            this.DocumentOverviewPaneViewModel = new DocumentOverviewPaneViewModel(this);

            //
            // Initialize the 'Open Documents' pane view-model.
            //
            this.OpenDocumentsPaneViewModel = new OpenDocumentsPaneViewModel(this);

            //
            // Add view-models for panes to the 'Panes' collection.
            //
            this.Panes = new ObservableCollection<AbstractPaneViewModel>();
            this.Panes.Add(this.DocumentOverviewPaneViewModel);
            this.Panes.Add(this.OpenDocumentsPaneViewModel);

            //
            // Add an example/test document view-model.
            //
            this.Documents = new ObservableCollection<TextFileDocumentViewModel>();
            this.Documents.Add(new TextFileDocumentViewModel(string.Empty, "test data!", true));
        }
        private void RunWithDebuggerFinalized() // On main UI thread.
        {
            if (null != workerParams.ExecException)
            {
                IDialogProvider dialogProvider = TextEditorCore.DialogProvider;
                if (null != dialogProvider)
                {
                    dialogProvider.ShowExceptionDialog(workerParams.ExecException);
                }
            }

            if (false == workerParams.ExecutionEnded)
            {
                if (null != workerParams.CurrentVmState)
                {
                    if (false != workerParams.CurrentVmState.isEnded)
                    {
                        IOutputStream messageList = Solution.Current.GetMessage(false);
                        DisplayCoreDump(workerParams.CurrentVmState.mirror, messageList);
                        SetExecutionState(ExecutionStateChangedEventArgs.States.Stopped);
                    }
                    else
                    {
                        SetExecutionState(ExecutionStateChangedEventArgs.States.Paused);
                    }
                }
            }
            else
            {
                // Done with the script.
                CleanUpRunners();
            }
        }
Exemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DcApplicationContext"/> class.
 /// </summary>
 /// <param name="dialogProvider">Dialog provider.</param>
 public DcApplicationContext(IDialogProvider dialogProvider, String instanceName, SecurityApplication applicationId, SanteDBHostType hostType)
     : base(new DcConfigurationManager(instanceName))
 {
     this.m_dialogProvider  = dialogProvider;
     c_application          = applicationId;
     this.InstanceName      = instanceName;
     this.m_santeDBHostType = hostType;
 }
Exemplo n.º 11
0
 public PageViewModel(IAnalyticsService analytics, INavigator navigator, Models.Page page, IDialogProvider dialogProvider)
 : base(analytics) {
     Title = page.Title;
     _navigator = navigator;
     _dialogProvider = dialogProvider;
     Page = page;
     ShowPageCommand = new Command(ShowPage);
 }
Exemplo n.º 12
0
        public AssassinationConversationLogic(IDialogProvider dialogProvider, ConversationManager conversationManager, CharacterObject conversationCharacter, bool sneakInSuccessful)
        {
            _dialogProvider        = dialogProvider;
            _conversationManager   = conversationManager;
            _conversationCharacter = conversationCharacter;

            _sneakInSuccessful = sneakInSuccessful;
        }
Exemplo n.º 13
0
 public HelloWorkflow(IHelloDialog dialog,
                      ISubscription subscription,
                      IDialogProvider dialogProvider,
                      ISerializationProvider serializationProvider)
     :
     base(dialog, subscription)
 {
     this.Connector = new Connector(dialogProvider, serializationProvider);
 }
        private void HandleException(Exception exception)
        {
            IDialogProvider dialogProvider = TextEditorCore.DialogProvider;

            if (null != dialogProvider)
            {
                dialogProvider.ShowExceptionDialog(exception);
            }
        }
Exemplo n.º 15
0
 public ImageFromFileEditorVM(IWorkspaceMan workspaceMan, IDialogProvider dialogProvider, IModelsProvider dataProvider)
 {
     this.workspaceMan     = workspaceMan;
     this.dialogProvider   = dialogProvider;
     this.dataProvider     = dataProvider;
     ImageAssetRefIdEditor = new EntryRefIdEditorVM(workspaceMan, typeof(IDbAsset));
     ImageAssetRefIdEditor.RefIdSelected = (newRefId) => { AssetRef = newRefId; };
     PropertyChanged += This_PropertyChanged;
 }
Exemplo n.º 16
0
 /// <summary>
 /// Initializes a new instance of the MainViewModel class.
 /// </summary>
 public MainViewModel(IBookRepository bRepo, IDialogProvider dialogProvider)
 {
     _bRepo = bRepo;
     _dialogProvider = dialogProvider;
     SelectedBook = null;
     SearchCommand = new RelayCommand(ExecuteSearch);
     ReadOnlineCommand = new RelayCommand(OpenBookOnline,
         () => SelectedBook != null && SelectedBook.WebReaderLink != null);
 }
Exemplo n.º 17
0
        public MainWindowViewModel(IMessageBoxService messageBoxService, IFileDialogService fileDialogService, IVersionChecker versionChecker, IDialogProvider dialogProvider)
        {
            this.messageBoxService = messageBoxService;
            this.fileDialogService = fileDialogService;
            this.dialogProvider    = dialogProvider;

            this.OpenCommand              = new RelayCommand(this.ExecuteOpenCommand);
            this.SaveCommand              = new RelayCommand(this.ExecuteSaveCommand);
            this.SaveAllCommand           = new RelayCommand(this.ExecuteSaveAllCommand);
            this.SaveAsCommand            = new RelayCommand(this.ExecuteSaveAsCommand);
            this.CloseDocumentCommand     = new RelayCommand(this.ExecuteCloseDocumentCommand);
            this.InsertXml14Command       = new RelayCommand(() => this.CurrentDocument?.InsertPart(XmlParts.RibbonX14));
            this.InsertXml12Command       = new RelayCommand(() => this.CurrentDocument?.InsertPart(XmlParts.RibbonX12));
            this.InsertXmlSampleCommand   = new RelayCommand <string>(this.ExecuteInsertXmlSampleCommand);
            this.InsertIconsCommand       = new RelayCommand(this.ExecuteInsertIconsCommand);
            this.ChangeIconIdCommand      = new RelayCommand(this.ExecuteChangeIconIdCommand);
            this.ToggleCommentCommand     = new RelayCommand(this.ExecuteToggleCommentCommand);
            this.RemoveCommand            = new RelayCommand(this.ExecuteRemoveItemCommand);
            this.ValidateCommand          = new RelayCommand(() => this.ValidateXml(true));
            this.GenerateCallbacksCommand = new RelayCommand(this.ExecuteGenerateCallbacksCommand);
            this.GoToCommand              = new RelayCommand(this.ExecuteGoToCommand);
            this.FindCommand              = new RelayCommand(() => this.PerformFindReplaceAction(FindReplaceAction.Find));
            this.FindNextCommand          = new RelayCommand(() => this.PerformFindReplaceAction(FindReplaceAction.FindNext));
            this.FindPreviousCommand      = new RelayCommand(() => this.PerformFindReplaceAction(FindReplaceAction.FindPrevious));
            this.IncrementalSearchCommand = new RelayCommand(() => this.PerformFindReplaceAction(FindReplaceAction.IncrementalSearch));
            this.ReplaceCommand           = new RelayCommand(() => this.PerformFindReplaceAction(FindReplaceAction.Replace));

            this.ShowSettingsCommand     = new RelayCommand(() => this.LaunchDialog <SettingsDialogViewModel, ScintillaLexer>(this.Lexer));
            this.ShowAboutCommand        = new RelayCommand(() => this.LaunchDialog <AboutDialogViewModel>(true));
            this.RecentFileClickCommand  = new RelayCommand <string>(this.FinishOpeningFile);
            this.ClosingCommand          = new RelayCommand <CancelEventArgs>(this.ExecuteClosingCommand);
            this.CloseCommand            = new RelayCommand(this.ExecuteCloseCommand);
            this.PreviewDragEnterCommand = new RelayCommand <DragEventArgs>(this.ExecutePreviewDragCommand);
            this.DropCommand             = new RelayCommand <DragEventArgs>(this.ExecuteDropCommand);
            this.NewerVersionCommand     = new RelayCommand(this.ExecuteNewerVersionCommand);

#if DEBUG
            if (this.IsInDesignMode)
            {
                return;
            }
#endif
            this.LoadXmlSchemas();
            this.LoadXmlSamples();

            foreach (var file in Environment.GetCommandLineArgs().Skip(1))
            {
                if (!File.Exists(file))
                {
                    continue;
                }

                this.FinishOpeningFile(file);
            }

            this.CheckVersionAsync(versionChecker);
        }
Exemplo n.º 18
0
 public ConfigurationVM(IDialogProvider dialogProvider, Configuration configurationModel)
 {
     TestCompileCommand      = new RelayCommand(TestCompile, ValidateTextScript);
     SaveCommand             = new RelayCommand(Save, () => ValidateName() && ValidateTextScript());
     CancelCommand           = new RelayCommand(Cancel);
     this.dialogProvider     = dialogProvider;
     this.configurationModel = configurationModel;
     name       = configurationModel.Name;
     textScript = configurationModel.TextScript;
 }
Exemplo n.º 19
0
        public static Mission OpenCapturedConversation(
            IEncounterProvider encounterProvider,
            IDialogProvider dialogProvider,
            IAssassinationActions assassinationActions,
            Settlement settlement,
            Hero assassinationTarget
            )
        {
            var encounterConfig = encounterProvider.GetCapturedEncounter(settlement);

            var locationToOpen = settlement.LocationComplex.GetLocationWithId(encounterConfig.LocationId);

            PlayerEncounter.Current.AddLocationEncounter(encounterConfig.LocationEncounter);

            var sceneName = locationToOpen.GetSceneName(encounterConfig.WallLevel);

            var dialogFlow = dialogProvider.GetCapturedDialogFlow(Hero.MainHero, assassinationTarget);

            var conversationManager = Campaign.Current.ConversationManager;

            var listenerHandle = new object();

            conversationManager.AddDialogFlow(dialogFlow, listenerHandle);

            CampaignEvents.ConversationEnded.AddNonSerializedListener(listenerHandle, character =>
            {
                CampaignEvents.ConversationEnded.ClearListeners(listenerHandle);

                conversationManager.RemoveRelatedLines(listenerHandle);

                assassinationActions.ApplyAssassinationFailedConsequences(settlement, Hero.MainHero, assassinationTarget);

                CampaignEvents.GameMenuOpened.AddNonSerializedListener(listenerHandle, args => {
                    CampaignEvents.GameMenuOpened.ClearListeners(listenerHandle);

                    GameMenu.SwitchToMenu("settlement_wait");
                });
            });

            return(SandBoxMissions.OpenConversationMission(
                       new ConversationCharacterData(Hero.MainHero.CharacterObject)
            {
                IsCivilianEquipmentRequired = true,
                NoHorse = true,
                NoWeapon = true
            },
                       new ConversationCharacterData(assassinationTarget.CharacterObject)
            {
                IsCivilianEquipmentRequired = true,
                NoWeapon = true,
                NoHorse = true
            },
                       sceneName
                       ));
        }
Exemplo n.º 20
0
        public static void RegisterInterfaces(IHostApplication hostApplication, IDialogProvider dialogProvider)
        {
            if (null != TextEditorCore.HostApplication)
            {
                string message = "'RegisterInterfaces' cannot be called twice!";
                throw new InvalidOperationException(message);
            }

            TextEditorCore.HostApplication = hostApplication;
            TextEditorCore.DialogProvider  = dialogProvider;
        }
Exemplo n.º 21
0
        public DialogViewModel(IDialogProvider dialogProvider)
        {
            _dialogProvider = dialogProvider;

            Title        = "Dialog example";
            LatestAction = "Did nothing yet";

            ShowAlertCommand       = new Command(ShowAlert);
            ShowConfirmCommand     = new Command(ShowConfirm);
            ShowActionSheetCommand = new Command(ShowActionSheet);
        }
 public MountainAreasViewModel(
     IMountainWeatherService mountainWeatherService,
     Func <Location, MountainAreaViewModel> areaViewModelFactory,
     IDialogProvider dialogProvider)
 {
     this._dialogProvider    = dialogProvider;
     _areaViewModelFactory   = areaViewModelFactory;
     _mountainWeatherService = mountainWeatherService;
     Title = "Mountain Areas";
     SetAreas();
 }
Exemplo n.º 23
0
 /// <summary>
 /// Initializes the <see cref="Dialog"/> class.
 /// </summary>
 static Dialog()
 {
     if (WindowsVersion.IsVistaOrNewer)
     {
         _dialogs = new VistaDialogProvider();
     }
     else
     {
         _dialogs = new LegacyDialogProvider();
     }
 }
 public MountainAreasViewModel(
     IMountainWeatherService mountainWeatherService, 
     Func<Location, MountainAreaViewModel> areaViewModelFactory,
     IDialogProvider dialogProvider)
 {
     this._dialogProvider = dialogProvider;
     _areaViewModelFactory = areaViewModelFactory;
     _mountainWeatherService = mountainWeatherService;
     Title = "Mountain Areas";
     SetAreas();
 }
Exemplo n.º 25
0
        public HelloWorkflow(IHelloDialog dialog,
                             ISubscription subscription,
                             IDialogProvider dialogProvider,
                             ISerializationProvider serializationProvider)
            :
            base(dialog, subscription)
        {
            this.Connector = new Connector(dialogProvider, serializationProvider);
            this.Handshake = new Handshake();

            dialog.RequestReceived += this.Dialog_RequestReceived;
        }
        public ForecastReportViewModel(
            Location location,
            IDialogProvider dialogProvider,
            IMountainWeatherService mountainWeatherService)
        {
            _location               = location;
            _dialogProvider         = dialogProvider;
            _mountainWeatherService = mountainWeatherService;

            Title = location.Name;
            LoadForecast();
        }
 public MissionLoader(IMissionOutcomeHandler missionOutcomeHandler,
                      IAssassinationActions assassinationActions,
                      IEncounterProvider encounterProvider,
                      IDialogProvider dialogProvider,
                      ILocationCharacterProvider locationCharacterProvider)
 {
     _missionOutcomeHandler     = missionOutcomeHandler;
     _assassinationActions      = assassinationActions;
     _encounterProvider         = encounterProvider;
     _dialogProvider            = dialogProvider;
     _locationCharacterProvider = locationCharacterProvider;
 }
        public ForecastReportViewModel(
            Location location,
            IDialogProvider dialogProvider,
            IMountainWeatherService mountainWeatherService)
        {
            _location = location;
            _dialogProvider = dialogProvider;
            _mountainWeatherService = mountainWeatherService;

            Title = location.Name;
            LoadForecast();
        }
Exemplo n.º 29
0
        /// <summary>
        /// Starts the application context using in-memory default configuration for the purposes of
        /// configuring the software
        /// </summary>
        /// <returns><c>true</c>, if temporary was started, <c>false</c> otherwise.</returns>
        public static bool StartTemporary(IDialogProvider dialogProvider, String appContextName = "OpenIZDC")
        {
            try
            {
                var retVal = new DcApplicationContext(dialogProvider);
                retVal.SetProgress("Run setup", 0);

                retVal.m_configurationManager = new DcConfigurationManager(DcConfigurationManager.GetDefaultConfiguration(appContextName), appContextName);

                ApplicationContext.Current         = retVal;
                ApplicationServiceContext.Current  = ApplicationContext.Current;
                ApplicationServiceContext.HostType = OpenIZHostType.OtherClient;
                retVal.ConfigurationManager.Configuration.GetSection <ApplicationConfigurationSection>().AppSettings.RemoveAll(o => o.Key == "http.index");
                retVal.ConfigurationManager.Configuration.GetSection <ApplicationConfigurationSection>().AppSettings.Add(new AppSettingKeyValuePair()
                {
                    Key = "http.index", Value = "/org.openiz.core/views/settings/index.html"
                });

                retVal.m_tracer = Tracer.GetTracer(typeof(DcApplicationContext));
                retVal.ThreadDefaultPrincipal = AuthenticationContext.SystemPrincipal;

                var appletService = retVal.GetService <IAppletManagerService>();

                retVal.SetProgress("Loading configuration", 0.2f);
                // Load all user-downloaded applets in the data directory
                foreach (var appPath in Directory.GetFiles(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "applets")))
                {
                    try
                    {
                        retVal.m_tracer.TraceInfo("Installing applet {0}", appPath);
                        using (var fs = File.OpenRead(appPath))
                        {
                            AppletPackage package = AppletPackage.Load(fs);
                            appletService.Install(package, true);
                        }
                    }
                    catch (Exception e)
                    {
                        retVal.m_tracer.TraceError("Loading applet {0} failed: {1}", appPath, e.ToString());
                        throw;
                    }
                }

                retVal.Start();

                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine("OpenIZ FATAL: {0}", e.ToString());
                return(false);
            }
        }
Exemplo n.º 30
0
        public MainVM(IDialogProvider dialogProvider, List <Configuration> configurationModels)
        {
            this.dialogProvider      = dialogProvider;
            this.configurationModels = configurationModels;

            EditCommand      = new RelayCommand(Edit, () => CurrentConfiguration != null);
            ReloadAllCommand = new RelayCommand(ReloadAll);
            ReplaceCommand   = new RelayCommand(Replace, () => !string.IsNullOrEmpty(sourceText) && CurrentConfiguration != null);

            Configurations = new BindingList <ConfigurationVM>();
            LoadConfigurationModels(configurationModels);
        }
Exemplo n.º 31
0
        public StreetsViewModel(IWebWorker web,
                                IParser parser,
                                IDialogProvider provider,
                                IMessage message)
        {
            _web      = web;
            _parser   = parser;
            _provider = provider;
            _message  = message;

            SetStreetCommand = new ActionCommand(CustomizeStreets);
            SetStreets(_parser.LoadStreets());
        }
Exemplo n.º 32
0
        public EditorApplicationVM(EditorApplication application, IServiceProvider managerCollection, IWorkspaceMan workspaceMan, SettingsMan settings, DbEntryEditorFactory dbEntryEditorFactory, IDialogProvider dialogProvider)
        {
            this.application          = application;
            this.managerCollection    = managerCollection;
            this.workspaceMan         = workspaceMan;
            this.settings             = settings;
            this.dbEntryEditorFactory = dbEntryEditorFactory;
            this.dialogProvider       = dialogProvider;

            lazyDbEditor = new Lazy <DbEditorVM>(() => managerCollection.GetService <DbEditorVM>());

            MenuItems = new BindingList <MenuItemVM>();

            Title = EditorApplication.APP_NAME;
        }
Exemplo n.º 33
0
        public MainViewModel()
        {
            var worker = IoC.Instance.Get <IWebWorker>();

            _parser   = IoC.Instance.Get <IParser>();
            _provider = IoC.Instance.Get <IDialogProvider>();
            var messageHelper  = IoC.Instance.Get <IMessageHelper>();
            var messageService = IoC.Instance.Get <IMessage>();

            StreetsViewModel = new StreetsViewModel(worker, _parser, _provider, messageService);
            HomesViewModel   = new HomesViewModel(_parser.LoadStreets(), worker, _parser, messageHelper, messageService);
            //EditHomesViewModel = new EditHomesViewModel(parser);

            OpenEditHomes = new DelegateCommand(OnEditHomes);
        }
Exemplo n.º 34
0
        /// <summary>
        /// Starts the application context using in-memory default configuration for the purposes of
        /// configuring the software
        /// </summary>
        /// <returns><c>true</c>, if temporary was started, <c>false</c> otherwise.</returns>
        public static bool StartTemporary(IDialogProvider dialogProvider, String instanceName, SecurityApplication applicationId, SanteDBHostType hostType)
        {
            try
            {
                var retVal = new DcApplicationContext(dialogProvider, instanceName, applicationId, hostType);
                retVal.SetProgress("Run setup", 0);
                //retVal.AddServiceProvider(typeof(ConfigurationManager));
                ApplicationServiceContext.Current = DcApplicationContext.Current = retVal;
                retVal.m_tracer = Tracer.GetTracer(typeof(DcApplicationContext));
                var configuration = retVal.Configuration.GetSection <DiagnosticsConfigurationSection>();
                foreach (var tr in configuration.TraceWriter)
                {
                    Tracer.AddWriter(Activator.CreateInstance(tr.TraceWriter, tr.Filter, tr.InitializationData, configuration.Sources.ToDictionary(o => o.SourceName, o => o.Filter)) as TraceWriter, tr.Filter);
                }
                retVal.GetService <IServiceManager>().AddServiceProvider(typeof(DefaultBackupService));

                var appletService = retVal.GetService <IAppletManagerService>();

                retVal.SetProgress("Loading configuration", 0.2f);
                // Load all user-downloaded applets in the data directory
                foreach (var appPath in Directory.GetFiles(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "applets")))
                {
                    try
                    {
                        retVal.m_tracer.TraceInfo("Installing applet {0}", appPath);
                        using (var fs = File.OpenRead(appPath))
                        {
                            AppletPackage package = AppletPackage.Load(fs);
                            appletService.Install(package, true);
                        }
                    }
                    catch (Exception e)
                    {
                        retVal.m_tracer.TraceError("Loading applet {0} failed: {1}", appPath, e.ToString());
                        throw;
                    }
                }

                retVal.GetService <IThreadPoolService>().QueueUserWorkItem((o) => retVal.Start());

                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine("SanteDB FATAL: {0}", e.ToString());
                return(false);
            }
        }
Exemplo n.º 35
0
        public EPFArchiveViewModel(IDialogProvider dialogProvider, Dispatcher dispatcher)
        {
            if (dialogProvider == null)
            {
                throw new ArgumentNullException(nameof(dialogProvider));
            }

            DialogProvider  = dialogProvider;
            this.dispatcher = dispatcher;

            Status               = new StatusViewModel();
            Entries              = new BindingList <EPFArchiveItemViewModel>();
            Locked               = false;
            IsArchiveOpened      = false;
            IsReadOnly           = true;
            IsArchiveSaveAllowed = false;

            Entries.ListChanged += (s, e) => { Status.TotalItems    = Entries.Count;
                                               Status.ItemsSelected = Entries.Count(item => item.IsSelected); };

            PropertyChanged += EPFArchiveViewModel_PropertyChanged;

            CommandTryCreateArchive       = new CommandRelay(() => TryCreateArchive(), () => true);
            CommandTryOpenArchive         = new CommandRelay(() => TryOpenArchive(), () => true);
            CommandTryOpenArchiveReadOnly = new CommandRelay(() => TryOpenArchiveReadOnly(), () => true);
            CommandTrySaveArchive         = new CommandRelay(() => TrySaveArchive(), () => true);
            CommandTrySaveArchiveAs       = new CommandRelay(() => TrySaveArchiveAs(), () => true);
            CommandTryCloseArchive        = new CommandRelay(() => TryCloseArchive(), () => true);
            CommandTryExtractAll          = new CommandRelay(() => TryExtractAll(), () => true);
            CommandTryExtractSelection    = new CommandRelay(() => TryExtractSelection(), () => true);

            CommandTryAddEntries            = new CommandRelay(() => TryAddEntries(), () => true);
            CommandTryRemoveSelectedEntries = new CommandRelay(() => TryRemoveSelectedEntries(), () => true);

            CommandSelectAll       = new CommandRelay(() => SelectAll(), () => true);
            CommandDeselectAll     = new CommandRelay(() => DeselectAll(), () => true);
            CommandInvertSelection = new CommandRelay(() => InvertSelection(), () => true);

            CommandSelectAll       = new CommandRelay(() => SelectAll(), () => true);
            CommandDeselectAll     = new CommandRelay(() => DeselectAll(), () => true);
            CommandInvertSelection = new CommandRelay(() => InvertSelection(), () => true);

            CommandTryExtractHiddenData = new CommandRelay(() => TryExtractHiddenData(), () => true);
            CommandTryUpdateHiddenData  = new CommandRelay(() => TryUpdateHiddenData(), () => true);
            CommandTryRemoveHiddenData  = new CommandRelay(() => TryRemoveHiddenData(), () => true);
        }
        public MainPageViewModel(IAnalyticsService analytics, PagesViewModel pagesViewModel, EventPagesViewModel eventPagesViewModel, NavigationViewModel navigationViewModel, TabViewModel tabViewModel,
            IDialogProvider dialogProvider, INavigator navigator,
            Func<IEnumerable<PageViewModel>, SearchViewModel> pageSearchViewModelFactory, PersistenceService persistence)
        : base (analytics) {
            Title = "Information";

            TabViewModel = tabViewModel;
            TabViewModel.PagesViewModel = pagesViewModel;
            TabViewModel.EventPagesViewModel = eventPagesViewModel;

            NavigationViewModel = navigationViewModel;
            NavigationViewModel.PropertyChanged += delegate(object sender, PropertyChangedEventArgs args)
            {
                if (args.PropertyName.Equals("SelectedPage"))
                {
                    //_pagesViewModel.SelectedPage = NavigationViewModel.SelectedPage;
                    //TODO current workaround
                    if (NavigationViewModel.SelectedPage != null && NavigationViewModel.SelectedPage.ShowPageCommand.CanExecute(null))
                    {
                        NavigationViewModel.SelectedPage.ShowPageCommand.Execute(null);
                        NavigationViewModel.IsPresented = false; // close master page, this should ideally be done within the NavigationViewModel itself (as in the Disclaimer button, the navigation closes itself as well) - Note for when this workaround is properly solved
                    }
                }
            };

            _pagesViewModel = pagesViewModel;
            _pagesViewModel.PropertyChanged += delegate(object sender, PropertyChangedEventArgs args)
            {
                if (args.PropertyName.Equals("LoadedPages"))
                {
                    var pages = _pagesViewModel.LoadedPages;
                    var key = Models.Page.GenerateKey("0", _location, _language);
                    NavigationViewModel.Pages =
                        new ObservableCollection<PageViewModel>(pages.Where(x => x.Page.ParentId == key)
                            .OrderBy(x => x.Page.Order));
                }
            };

            _dialogProvider = dialogProvider;
            _navigator = navigator;
            _pageSearchViewModelFactory = pageSearchViewModelFactory;
            _persistence = persistence;
        }
        public MainContentPageViewModel(IAnalyticsService analytics, INavigator navigator,
                                        DataLoaderProvider dataLoaderProvider, Func <Page, PageViewModel> pageViewModelFactory
                                        , IDialogProvider dialogProvider
                                        , Func <PageViewModel, IList <PageViewModel>, MainTwoLevelViewModel> twoLevelViewModelFactory
                                        , Func <IEnumerable <PageViewModel>, SearchViewModel> pageSearchViewModelFactory
                                        , IViewFactory viewFactory, Func <string, GeneralWebViewPageViewModel> generalWebViewFactory
                                        , Func <string, PdfWebViewPageViewModel> pdfWebViewFactory,
                                        Func <string, ImagePageViewModel> imagePageFactory)
            : base(analytics, dataLoaderProvider)
        {
            Title      = AppResources.Categories;
            Icon       = Device.RuntimePlatform == Device.Android ? null : "home150";
            _navigator = navigator;
            _navigator.HideToolbar(this);
            _dataLoaderProvider         = dataLoaderProvider;
            _pageViewModelFactory       = pageViewModelFactory;
            _twoLevelViewModelFactory   = twoLevelViewModelFactory;
            _dialogProvider             = dialogProvider;
            _pageSearchViewModelFactory = pageSearchViewModelFactory;
            _viewFactory           = viewFactory;
            _generalWebViewFactory = generalWebViewFactory;
            _pdfWebViewFactory     = pdfWebViewFactory;
            _imagePageFactory      = imagePageFactory;

            _shownPages = new Stack <PageViewModel>();

            ItemTappedCommand     = new Command(OnPageTapped);
            OpenSearchCommand     = new Command(OnOpenSearch);
            ChangeLanguageCommand = new Command(OnChangeLanguage);
            ChangeLocationCommand = new Command(OnChangeLocation);
            OpenContactsCommand   = new Command(OnOpenContacts);

            // add search icon to toolbar
            ToolbarItems = new List <ToolbarItem>
            {
                new ToolbarItem {
                    Text = AppResources.Search, Icon = "search.png", Command = OpenSearchCommand
                }
            };

            Current = this;
        }
Exemplo n.º 38
0
        private string PromptScriptSave()
        {
            string fileName = "Document";

            if (null != parsedScript)
            {
                string filePath = parsedScript.GetScriptPath();
                fileName = Path.GetFileNameWithoutExtension(filePath);
            }
            // Configure save file dialog box

            IDialogProvider saveDialogProvider = TextEditorCore.DialogProvider;

            if (saveDialogProvider.ShowSaveFileDialog(ref fileName))
            {
                return(fileName);
            }

            return(null);
        }
 public MessangerService(
     IUserProvider userProvider,
     ICypherProvider cypherProvider,
     IMessageProvider messageProvider,
     IDialogProvider dialogProvider,
     IStrongKeyProvider strongKeyProvider,
     IMessangerCryptor messangerCryptor,
     IConnectionCacheService connectionCacheService,
     ILoggerFactory loggerFactory
     )
 {
     this.userProvider           = userProvider;
     this.cypherProvider         = cypherProvider;
     this.messangerCryptor       = messangerCryptor;
     this.messageProvider        = messageProvider;
     this.logger                 = loggerFactory.CreateLogger <MessangerService>();
     this.strongKeyProvider      = strongKeyProvider;
     this.dialogProvider         = dialogProvider;
     this.connectionCacheService = connectionCacheService;
 }
Exemplo n.º 40
0
        public static void RegisterInterfaces(IHostApplication hostApplication, IDialogProvider dialogProvider)
        {
            if (null != TextEditorCore.HostApplication)
            {
                string message = "'RegisterInterfaces' cannot be called twice!";
                throw new InvalidOperationException(message);
            }

            TextEditorCore.HostApplication = hostApplication;
            TextEditorCore.DialogProvider = dialogProvider;
        }
 public EventPageViewModel(IAnalyticsService analytics, INavigator navigator, EventPage page, IDialogProvider dialogProvider) : base(analytics, navigator, page, dialogProvider)
 {
 }