Exemple #1
0
        private async Task <bool> ImportProp(string path)
        {
            var dependencyResolver = this.GetDependencyResolver();
            var pleaseWaitService  = dependencyResolver.Resolve <IPleaseWaitService>();

            pleaseWaitService.Show();
            try
            {
                IModelImport import = new XModelImport();
                var          p      = await import.ImportAsync(path);

                if (p != null)
                {
                    Prop     = p;
                    FilePath = String.Empty;
                    //Switch to selection mode VIX-2784
                    DrawingPanelViewModel.IsDrawing = false;
                }
            }
            catch (Exception e)
            {
                pleaseWaitService.Hide();
                Logging.Error(e, "An error occuring importing the xModel.");
                var mbs = new MessageBoxService();
                mbs.ShowError($"An error occurred importing the xModel. Please notify the Vixen Team.", "Error Importing xModel");
                return(false);
            }

            pleaseWaitService.Hide();

            return(true);
        }
Exemple #2
0
        /// <summary>
        /// Method to invoke when the Import command is executed.
        /// </summary>
        private async void Import(string type)
        {
            var dependencyResolver = this.GetDependencyResolver();
            var openFileService    = dependencyResolver.Resolve <IOpenFileService>();

            openFileService.IsMultiSelect    = false;
            openFileService.InitialDirectory = Environment.SpecialFolder.MyDocuments.ToString();
            openFileService.Filter           = "xModel (*.xmodel)|*.xmodel";
            if (await openFileService.DetermineFileAsync())
            {
                string path = openFileService.FileNames.First();
                if (!string.IsNullOrEmpty(path))
                {
                    IModelImport import = new XModelImport();
                    Prop = await import.ImportAsync(path);

                    FilePath = String.Empty;
                }
            }
        }