Exemplo n.º 1
0
        public void Execute(object parameter)
        {
            RadOpenFileDialog openFileDialog = new RadOpenFileDialog();

            openFileDialog.Multiselect       = true;
            openFileDialog.IsDragDropEnabled = true;

            openFileDialog.ShowDialog();

            if (openFileDialog.DialogResult == true)
            {
                var result = openFileDialog.FileNames;
                PersonLightMessage message = new PersonLightMessage();
                message.Person = parameter as Person;
                foreach (var item in result)
                {
                    FileInfo fileInfo = new FileInfo(item);
                    message.FileNameDocs.Add(new FileNameDoc()
                    {
                        Name = fileInfo.Name, Path = fileInfo.DirectoryName
                    });
                }
                Messenger.Default.Send <PersonLightMessage>(message, "AddFile");
            }
        }
        private void RadButton_Click(object sender, RoutedEventArgs e)
        {
            var fileContent = string.Empty;
            RadOpenFileDialog openFileDialog = new RadOpenFileDialog()
            {
                Filter      = "|PDF Files (*.pdf)|*.pdf",
                FilterIndex = 1,
            };

            openFileDialog.ShowDialog();

            if (openFileDialog.DialogResult == true)
            {
                try
                {
                    Stream fileStream = openFileDialog.OpenFile();
                    ConvertPDF(fileStream);
                    MemoryStream ms = new MemoryStream(PDFBodyBytes);
                    EmptyContent.Visibility = Visibility.Collapsed;
                    PDFBody = new PdfDocumentSource(ms);
                    pdfViewer.DocumentSource = new PdfDocumentSource(ms);
                }
                catch
                {
                }
            }
        }
Exemplo n.º 3
0
        private void EventButtonSettingFileSelect(object sender, EventArgs e)
        {
            RadOpenFileDialog dialog = new RadOpenFileDialog();
            DialogResult      result = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                StxFile.Text = dialog.FileName;
            }
        }
Exemplo n.º 4
0
        private void OnSelectFile(object obj)
        {
            RadOpenFileDialog openFileDialog = new RadOpenFileDialog()
            {
                Filter = "Txt Files (*.txt)|*.txt"
            };

            openFileDialog.ShowDialog();

            this.FilePath = openFileDialog.FileName;
        }
Exemplo n.º 5
0
        private void btnImportText_Click(object sender, RoutedEventArgs e)
        {
            RadOpenFileDialog ofd = new RadOpenFileDialog();

            // Show open folder dialog and check if Open button is pressed.\

            if (ofd.ShowDialog() == true)
            {
                txtPathTxtFolder.Text = ofd.FileName;
            }
        }
Exemplo n.º 6
0
        private void OpenFile(object parameter)
        {
            RadOpenFileDialog ofd = new RadOpenFileDialog();

            string stringParameter = parameter as string;

            if (stringParameter != null && stringParameter.Contains("|"))
            {
                ofd.Filter = stringParameter;
            }
            else
            {
                string filter = string.Join("|", DocumentFormatProvidersManager.FormatProviders.Where(fp => fp.CanImport)
                                            .OrderBy(fp => fp.Name)
                                            .Select(fp => FileHelper.GetFilter(fp))
                                            .ToArray()) + "|All Files|*.*";
                ofd.Filter = filter;
            }

            if (ofd.ShowDialog() == true)
            {
                string extension;
                extension = Path.GetExtension(ofd.FileName).ToLower();

                IDocumentFormatProvider provider =
                    DocumentFormatProvidersManager.GetProviderByExtension(extension);

                if (provider == null)
                {
                    MessageBox.Show(LocalizationManager.GetString("Documents_OpenDocumentCommand_UnsupportedFileFormat"));
                    return;
                }

                try
                {
                    Stream stream;
                    stream = ofd.OpenFile();
                    using (stream)
                    {
                        RadDocument document = provider.Import(stream);
                        this.radRichTextBox.Document = document;
                        this.SetDocumentName(ofd.FileName);
                    }
                }
                catch (IOException)
                {
                    MessageBox.Show(LocalizationManager.GetString("Documents_OpenDocumentCommand_TheFileIsLocked"));
                }
                catch (Exception)
                {
                    MessageBox.Show(LocalizationManager.GetString("Documents_OpenDocumentCommand_TheFileCannotBeOpened"));
                }
            }
        }
Exemplo n.º 7
0
        private void OnOpenFile(object sender, ExecutedRoutedEventArgs e)
        {
            var dialog = new RadOpenFileDialog()
            {
                Multiselect = false, Filter = "所有文件 (*.*)|*.*"
            };

            if (dialog.ShowDialog() == true)
            {
                using (var stream = dialog.OpenFile()) {
                    Editor.Document.LoadFile(stream, Encoding.UTF8);
                }

                FilePath = dialog.FileName;
            }
        }
Exemplo n.º 8
0
        private async void Button1_Click(object sender, RoutedEventArgs e)
        {
            RadOpenFileDialog openFileDialog = new RadOpenFileDialog();

            openFileDialog.Owner  = this;
            openFileDialog.Filter = "|Image Files|*.jpg;*.png";
            openFileDialog.ShowDialog();
            if (openFileDialog.DialogResult == true)
            {
                string fileName = openFileDialog.FileName;
                var    result   = await MakeAnalysisRequest(fileName);

                var res = JsonConvert.DeserializeObject <ImageResponse>(result);
                this.Confidence = (double)(this.CalculatePortraitProbability(res) * 100);
            }
        }
Exemplo n.º 9
0
        private void OpenButten_Click(object sender, RoutedEventArgs e)
        {
            RadOpenFileDialog OpenFileDialog = new RadOpenFileDialog()
            {
                Filter = "Diagram Documents (*.diagram)|*.diagram" +
                         "|All Files (*.*)|*.*",
                FilterIndex = 0
            };

            OpenFileDialog.ShowDialog();
            var path = OpenFileDialog.FileName;

            if (OpenFileDialog.DialogResult == true)
            {
                Open(diagram, path);
            }
        }
Exemplo n.º 10
0
        private void SelectJavafolderbutton_Click(object sender, EventArgs e)
        {
            RadOpenFileDialog openFileDialog = new RadOpenFileDialog
            {
                InitialDirectory         = Environment.CurrentDirectory,
                RestoreDirectory         = true,
                ExpandToCurrentDirectory = false,
                FileName   = "Java",
                DefaultExt = ".exe",
                Filter     = "Executable file|*.exe"
            };

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                javaExecutableBox.Text = openFileDialog.FileName;
            }
        }
        private void OnFileOpen(object obj)
        {
            string            parameter      = (string)obj;
            RadOpenFileDialog openFileDialog = new RadOpenFileDialog();

            openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments);
            if (parameter.Equals("Currency"))
            {
                if (currencyInfo != null && currencyInfo.Exists)
                {
                    openFileDialog.InitialDirectory = currencyInfo.DirectoryName;
                }
            }
            if (parameter.Equals("Commitment"))
            {
                if (commitmentInfo != null && commitmentInfo.Exists)
                {
                    openFileDialog.InitialDirectory = commitmentInfo.DirectoryName;
                }
            }
            if (parameter.Equals("Cashflows"))
            {
                if (cashFlowInfo != null && cashFlowInfo.Exists)
                {
                    openFileDialog.InitialDirectory = cashFlowInfo.DirectoryName;
                }
            }
            openFileDialog.ShowDialog();
            if (openFileDialog.DialogResult == true)
            {
                if (parameter.Equals("Currency"))
                {
                    CurrencyFileName = openFileDialog.FileName;
                }
                if (parameter.Equals("Commitment"))
                {
                    CommitmentFileName = openFileDialog.FileName;
                }
                if (parameter.Equals("Cashflows"))
                {
                    CashFlowFileName = openFileDialog.FileName;
                }
            }
        }
Exemplo n.º 12
0
        public CombinerViewModel()
        {
            openFileDialog = new RadOpenFileDialog {
                Owner = Application.Current.MainWindow, ExpandToCurrentDirectory = false
            };
            openFileDialog.Filter      = "PDF Documents|*.pdf";
            openFileDialog.Multiselect = true;

            saveFileDialog = new RadSaveFileDialog {
                Owner = Application.Current.MainWindow, ExpandToCurrentDirectory = false
            };
            saveFileDialog.Filter = "PDF Documents|*.pdf";

            AddItemCommand      = new DelegateCommand(AddItem);
            ClearCommand        = new DelegateCommand(ClearItems);
            CombineItemsCommand = new DelegateCommand(CombineItems);

            ItemsToMerge.CollectionChanged += ItemsToMerge_CollectionChanged;
        }
Exemplo n.º 13
0
        private void pickFileDesignBtn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                RadOpenFileDialog rofd = new RadOpenFileDialog();
                rofd.ShowDialog();

                if (rofd.FileName == "" || rofd.FileName == null)
                {
                    return;
                }

                txtPathDesign.Text = rofd.FileName;
            }
            catch (Exception err)
            {
                MessageBox.Show("Pick file design error: " + err.Message);
            }
        }
Exemplo n.º 14
0
        public static bool ShowOpenFileDialog(out string fileName, string filter = "", string caption = "Выберите файл")
        {
            fileName = "";
            try
            {
                RadOpenFileDialog openFileDialog = new RadOpenFileDialog();
                openFileDialog.Owner = MainClass.MainAppwindow;
                //openFileDialog.Filter = filter;

                openFileDialog.ShowDialog();
                fileName = openFileDialog.FileName;

                return(openFileDialog.DialogResult == true);
            }
            catch (Exception e)
            {
                logger.Error("Error ShowOpenFileDialog " + e.Message);
                return(false);
            }
        }
        private void BrowseButton_Click(object sender, RoutedEventArgs e)
        {
            RadOpenFileDialog openFileDialog = new RadOpenFileDialog
            {
                Owner  = this,
                Filter = "Image files (*.jpg)|*.jpg|All Files (*.*)|*.*",
            };

            openFileDialog.ShowDialog();
            if (openFileDialog.DialogResult == true)
            {
                string selectedFileName = openFileDialog.FileName;
                FileNameLabel.Content = selectedFileName;
                BitmapImage bitmap = new BitmapImage();
                bitmap.BeginInit();
                bitmap.UriSource = new Uri(selectedFileName);
                bitmap.EndInit();
                ImageViewer1.Source = bitmap;
                imageInDb           = ToBytes(bitmap);
            }
        }
Exemplo n.º 16
0
        void exp()
        {
            RadOpenFolderDialog openFolderDialog = new RadOpenFolderDialog();

            openFolderDialog.ShowDialog();
            this.storage.FolderName = openFolderDialog.FileName;
            RadOpenFileDialog radOpenFileDialog = new RadOpenFileDialog()
            {
                Filter = "Word Documents (*.doc)|*.doc|Excel Worksheets (*.xls;*.xlsx)|*.xls;*.xlsx|PowerPoint Presentations (*.ppt)|*.ppt" +
                         "|Office Files (*.doc;*.xls;*.ppt)|*.doc;*.xls;*.ppt" +
                         "|All Files (*.*)|*.*",
                FilterIndex = 5,
            };

            radOpenFileDialog.ShowDialog();
            RadSaveFileDialog saveFileDialog = new RadSaveFileDialog()
            {
                Filter = "Word Documents (*.doc)|*.doc|Excel Worksheets (*.xls;*.xlsx)|*.xls;*.xlsx|PowerPoint Presentations (*.ppt)|*.ppt" +
                         "|Office Files (*.doc;*.xls;*.ppt)|*.doc;*.xls;*.ppt" +
                         "|All Files (*.*)|*.*",
                FilterIndex = 5,
            };

            //saveFileDialog.FileName = storageFile != null ? storageFile.Name : null;
            saveFileDialog.ShowDialog();
            if (saveFileDialog.DialogResult == true)
            {
            }

            //this.explorer.Filter = "Word Documents|*.doc;*.docx|Excel Worksheets|*.xls;*.xlsx|PowerPoint Presentations|*.ppt;*.pptx" +
            //                            "|Office Files|*.doc;*.docx*.xls;*.xlsx;*.ppt*.pptx" +
            //                            "|Image Files|*.jpg;*.png;*.bmp" +
            //                            "|Text Files|*.txt;" +
            //                            "|Archives Files|*.zip;*.rar" +
            //                            "|All Files|*.*";
        }
        private void RdCmdBtnOpenFile_Click(object sender, EventArgs e)
        {
            try
            {
                using (RadOpenFileDialog OpenDlg = new RadOpenFileDialog())
                {
                    DtExcelData             = new DataTable();
                    RdGrdTraders.DataSource = null;
                    RdGrdTraders.DataSource = null;
                    RdGrdTraders.Rows.Clear();
                    RdGrdTraders.Rows.Clear();
                    RdTxtExcelFile.Text = string.Empty;
                    RdDdExcelSheet.Items.Clear();
                    RdDdExcelSheet.Text = string.Empty;


                    OpenDlg.DefaultExt       = ".xlsx";
                    OpenDlg.Filter           = "Excel File(*.xlsx)|*.xlsx";
                    OpenDlg.MultiSelect      = false;
                    OpenDlg.InitialDirectory = Path.GetFullPath(Environment.SpecialFolder.Desktop.ToString());
                    if (OpenDlg.ShowDialog() == DialogResult.OK)
                    {
                        Cursor = Cursors.WaitCursor;

                        RdTxtExcelFile.Text = OpenDlg.FileName;
                        GetExcelSheet(RdTxtExcelFile.Text.Trim());
                        Cursor = Cursors.Default;
                    }
                }
            }
            catch (Exception ex)
            {
                ClsMessage._IClsMessage.ProjectExceptionMessage(ex);
                Cursor = Cursors.Default;
            }
        }