Beispiel #1
0
        private void FileOpen()
        {
            CurrentModelPath = FileDialogService.OpenFileDialog("models", null, OpenFileFilter, ".3ds");
#if !DEBUG
            try
            {
#endif

            /*
             * CurrentModel = ModelImporter.Load(CurrentModelPath);
             * Rect3D r = CurrentModel.Bounds;
             * CurrentModel.Transform = new TranslateTransform3D(-(r.X + (r.SizeX / 2)), -(r.Y + (r.SizeY / 2)), -(r.Z + (r.SizeZ / 2)));
             * CurrentModel.Freeze();
             * ModelVisual3D rawVisual = null;
             * if (rawVisual == null) rawVisual = new RawVisual3D();
             * rawVisual.Content = CurrentModel;
             * _rootVisual.Children.Add(rawVisual);
             *
             * //*/
            LoadJawFile(CurrentModelPath);
#if !DEBUG
        }
        catch (Exception e)
        {
            MessageBox.Show(e.Message);
        }
#endif
        }
        private void InvokeOpenFileDialog(string name)
        {
            var path = _fileDialogService.OpenFileDialog();

            if (path == null)
            {
                return;
            }

            switch (name)
            {
            case "AdjacencyMatrix":
                AdjacencyMatrixFilePath = path;
                break;

            case "Departures":
                DeparturesFilePath = path;
                break;

            case "Arrivals":
                ArrivalsFilePath = path;
                break;

            case "DirectTravelersMatrix":
                DirectTravelersMatrixFilePath = path;
                break;

            case "NodesPositions":
                NodesPositionsFilePath = path;
                break;

            default:
                return;
            }
        }
 protected virtual string GetLibraryFilename(FileOperation operation)
 {
     fileDialogService.IntialDirectory = @"C:\GENIE2K\CAMFILES";
     fileDialogService.Filter          = "(*.nlb)|*.nlb|(*.cnf)|*.cnf|(*.tlb)|*.tlb|All Files (*.*)|*.*";
     fileDialogService.DefaultExt      = ".nlb";
     return(fileDialogService.OpenFileDialog(operation));
 }
        /// <inheritdoc/>
        public virtual async Task <(Bitmap?Image, string Path)> NonBlockOpen(string?filters)
        {
            var result = await _sta.StartSTATask(
                () => _dialog.OpenFileDialog(filters)
                ).ConfigureAwait(false);

            return(await result.ConfigureAwait(false));
        }
        private void ImportFromFile()
        {
            if (_fileDialogService.OpenFileDialog())
            {
                const string  noError     = "Нет ошибки";
                List <string> barcodeList = _textFileService.GetFromFile(_fileDialogService.FilePath) as List <string>;
                List <Tuple <string, string> > barcodeToImportResult = new List <Tuple <string, string> >();
                int errorAmount = barcodeList.Count;

                foreach (var bc in barcodeList)
                {
                    string error = GetValidationError(bc);

                    if (string.IsNullOrEmpty(error))
                    {
                        error = noError;
                        errorAmount--;
                    }

                    barcodeToImportResult.Add(new Tuple <string, string>(bc, error));
                }

                if (errorAmount > 0 && errorAmount < barcodeList.Count && barcodeToImportResult.Count > 0)
                {
                    string msg = $"Импорт был совершен не полностью. Условиям удовлетворяют {barcodeList.Count-errorAmount} из {barcodeList.Count} штрихкодов. Добавить их?";
                    _dialogService.ShowDialog("CustomMessageBoxView", new DialogParameters($"message={msg}&systemIcon=Warning&dialogButtons=YesNo&title=Результат"), r =>
                    {
                        if (r.Result == ButtonResult.Yes)
                        {
                            foreach (var bc in barcodeToImportResult)
                            {
                                if (bc.Item2.Equals(noError))
                                {
                                    BarcodeCollection.Add(bc.Item1);
                                }
                            }
                        }
                    });
                }
                else if (errorAmount == 0 && barcodeToImportResult.Count > 0)
                {
                    foreach (var bc in barcodeToImportResult)
                    {
                        BarcodeCollection.Add(bc.Item1);
                    }
                    string msg = $"Импорт был завершен успешно! Добавлены все ({barcodeList.Count}) штрихкоды.";
                    _dialogService.ShowDialog("CustomMessageBoxView", new DialogParameters($"message={msg}&systemIcon=Asterisk&dialogButtons=Ok&title=Результат"), null);
                }
                else
                {
                    string msg = $"Импорт был завершен с ошибкой. Не удалось добавить штрихкоды ({barcodeList.Count}) из файла.";
                    _dialogService.ShowDialog("CustomMessageBoxView", new DialogParameters($"message={msg}&systemIcon=Error&dialogButtons=Ok&title=Результат"), null);
                }
            }
        }
Beispiel #6
0
        private void OnGetArtworkFromFile()
        {
            var result = _fileDialogService.OpenFileDialog(FileType.Images);

            if (result == null)
            {
                return;
            }

            UpdateArtwork(_imageProcessingService.GetImageBytesFromFile(result));
        }
Beispiel #7
0
        private void OnOpenImageBtnClick()
        {
            string file = mFileDialogService.OpenFileDialog(null,
                                                            new string[] { ".bmp", ".jpg" });

            if (file == String.Empty)
            {
                return;
            }
            LoadImage(file);
        }
Beispiel #8
0
        public T Import <T>(IFileDialogService dialogService, IFileService fileService)
        {
            try
            {
                if (dialogService.OpenFileDialog() == true)
                {
                    var items = fileService.GetFromFile <T>(dialogService.FilePath);

                    if (items == null || !string.IsNullOrEmpty(fileService.ErrorString))
                    {
                        _dialogService.ShowDialog("Ошибка", new CustomMessageBoxViewModel(fileService.ErrorString, SystemIcons.Error));
                        return(default);
Beispiel #9
0
        private void OpenFileDialog()
        {
            FileObject fileObject = _fileService.OpenFileDialog();

            if (fileObject?.FileNames.Length > 0)
            {
                for (int i = 0; i < fileObject.FileNames.Length; i++)
                {
                    if (!MailObject.Attachments.Contains(fileObject.FileNames[i]))
                    {
                        MailObject.Attachments.Add(fileObject.FileNames[i]);
                        FileNames.Add(fileObject.SafeFileNames[i]);
                    }
                }
            }
        }
Beispiel #10
0
        private void FileOpen()
        {
            CurrentModelPath = FileDialogService.OpenFileDialog("models", null, OpenFileFilter, ".3ds");
#if !DEBUG
            try
            {
#endif
            CurrentModel     = ModelImporter.Load(CurrentModelPath);
            ApplicationTitle = String.Format(TitleFormatString, CurrentModelPath);
            HelixView.ZoomExtents(0);
#if !DEBUG
        }
        catch (Exception e)
        {
            MessageBox.Show(e.Message);
        }
#endif
        }
        private void LoadSqlExpression()
        {
            try
            {
                using (_fileDialogService)
                {
                    _fileDialogService.OpenFileExtension = "SQL запрос (*.sql)|*.sql";

                    string path = _fileDialogService.OpenFileDialog();

                    if (!string.IsNullOrEmpty(path))
                    {
                        SqlExpression = Formatter.GetFileContent(path);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageService.ShowError(ex.Message);
            }
        }
Beispiel #12
0
 void FileDialog()
 {
     var filename = fileDialogService.OpenFileDialog("");
 }