Exemple #1
0
        internal static bool OpenPalette(out Palette palette)
        {
            palette = new Palette();
            System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog();
            ofd.DefaultExt = ".col";
            ofd.Filter     = "All Formats |*.col;*.gpl|Colora Palette |*.col|GIMP Palette |*.gpl";
            ofd.Title      = "Open Color Palette";
            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    switch (Path.GetExtension(ofd.FileName))
                    {
                    case ".gpl":
                        palette = openGimpPalette(ofd.FileName);
                        break;

                    default:
                        palette = openColoraPalette(ofd.FileName);
                        break;
                    }
                    ofd.Dispose();
                    return(true);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(String.Format("{0} {1}", Properties.Resources.PaletteWindow_strErrorOpen, ex.Message), "", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            ofd.Dispose();
            return(false);
        }
Exemple #2
0
        public static string SearchOpenFile(string fileExt, string initFileDir = null, string initFileName = null)
        {
            System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog()
            {
                AddExtension     = true,
                CheckFileExists  = true,
                CheckPathExists  = true,
                DefaultExt       = fileExt,
                Filter           = string.Format("{0} file|*.{1}|all files|*.*", fileExt.ToUpper(), fileExt),
                FilterIndex      = 1,
                Multiselect      = false,
                Title            = string.Format("Открыть {0} файл", fileExt.ToUpper()),
                InitialDirectory = initFileDir,
                FileName         = initFileName
            };

            string fileName = null;

            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                fileName = ofd.FileName;
            }
            ofd.Dispose();

            return(fileName);
        }
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         dlg.Dispose();     // dispose the dialog
     }
 }
 private void Init_Bank_B_Click(object sender, RoutedEventArgs e)
 {
     if (IsClosing)
     {
         return;
     }
     if (Wwise_Player.IsExecution)
     {
         Message_Feed_Out("内容がクリアされていません。先に右下のクリアボタンを押す必要があります。");
         return;
     }
     System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog()
     {
         Title       = "Init.bnkを選択してください。",
         Filter      = "Init.bnk(Init.bnk)|Init.bnk",
         Multiselect = false
     };
     if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         try
         {
             Wwise_Player.Dispose();
             Wwise_Player.Init(ofd.FileName, 1, Volume_S.Value / 100);
             Init_Bank_B.Visibility      = Visibility.Hidden;
             Init_Bank_Help_B.Visibility = Visibility.Hidden;
             IsInitSelected = true;
         }
         catch
         {
             Message_Feed_Out("エラーが発生しました。Wwiseを初期化できません。");
         }
     }
     ofd.Dispose();
 }
        public void AddImageAction()
        {
            System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
            dlg.Filter = "Images|*.png;*.gif;*.jpg";

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string[]     filePath = dlg.FileNames;
                StreamReader sr       = new StreamReader(filePath[0]);
                BinaryReader read     = new BinaryReader(sr.BaseStream);
                byte[]       Pict     = read.ReadBytes((int)sr.BaseStream.Length);

                MemoryStream stream = new MemoryStream(Pict);
                stream.Position = 0;
                BitmapImage bi = new BitmapImage();
                bi.BeginInit();
                bi.StreamSource = stream;
                bi.EndInit();

                ImageSource imgsrc = bi;
                Image       newimg = new Image();
                newimg.Source = imgsrc;

                ObservableCollection <Image> listimage = new ObservableCollection <Image>();
                foreach (Image img in Pictures)
                {
                    listimage.Add(img);
                }


                listimage.Add(newimg);
                Pictures = listimage;
            }
            dlg.Dispose();
        }
 private void Add_Texture_B_Click(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog()
     {
         Title       = "追加する画像を選択してください。",
         Multiselect = true,
         Filter      = "画像ファイル(*.png;*.jpg;*.jpeg;*.bmp;*.gif;*.tiff;*.exif;*.dds)|*.png;*.jpg;*.jpeg;*.bmp;*.gif;*.tiff;*.exif;*.dds"
     };
     if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         string Error_File = "";
         foreach (string File_Name in ofd.FileNames)
         {
             if (!Add_Texture(File_Name, new System.Drawing.Point(750, 450)))
             {
                 if (Error_File == "")
                 {
                     Error_File = File_Name;
                 }
                 else
                 {
                     Error_File += "\n" + File_Name;
                 }
             }
         }
         if (Error_File != "")
         {
             MessageBox.Show("エラー:以下のファイルを追加できませんでした。\n" + Error_File);
             Message_Feed_Out("エラー:追加されなかった画像が" + (Error_File.CountOf("\n") + 1) + "個存在します。");
         }
     }
     ofd.Dispose();
 }
        /// <summary>
        /// 添加数据菜单点击事件
        /// </summary>
        private void MenuItemAdd_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog(); //打开打开文件窗口
            openFileDialog.Title            = "导入新的台风路径数据";                                                 //打开文件窗口标题
            openFileDialog.Filter           = "文本文件(*.txt)|*.txt|All files(*.*)|*.*";                       //选择为txt文件和所有文件
            openFileDialog.Multiselect      = true;                                                         //可以多选
            openFileDialog.RestoreDirectory = true;                                                         //记录目录
            string msg = string.Empty;

            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string[] fileName = openFileDialog.FileNames;         //获取选择的文件名
                for (int i = 0; i < fileName.Length; i++)
                {
                    if (ImportToDB(fileName[i]))             //导入数据承购是否
                    {
                        msg += DateTime.Now.ToString() + " Import " + Path.GetFileName(fileName[i]) + " succeed\n";
                    }
                    else
                    {
                        msg += DateTime.Now.ToString() + " Import " + Path.GetFileName(fileName[i]) + " failed\n";
                    }
                }
                MessageBox.Show(msg, "导入新台风数据", MessageBoxButton.OK, MessageBoxImage.Information);              //显示记录信息
            }
            openFileDialog.Dispose();
        }
Exemple #8
0
 private void Btn_SelectVideo_Click(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog();
     //ofd.Filter = "*.mxf|MXF File|*.MXF|*.8km|8KM File|*.*|All";
     ofd.Multiselect = false;
     if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         mediaPlayerViewModel.VideoPath = ofd.FileName;
     }
     ofd.Dispose();
 }
        private void OnLoadFileButtonClicked(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog {
                Title = "Datei zum Anhängen auswählen"
            };

            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                LinkBox.Text = openFileDialog.FileName;
            }
            openFileDialog.Dispose();
        }
 private void SE_Add_B_Click(object sender, RoutedEventArgs e)
 {
     if (IsClosing)
     {
         return;
     }
     if (SE_List.SelectedIndex == -1)
     {
         Message_Feed_Out("SEの種類を選択してください。");
         return;
     }
     System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog()
     {
         Title       = "サウンドファイルを選択してください。",
         Filter      = "サウンドファイル(*.aac;*.flac;*.m4a;*.mp3;*.mp4;*.ogg;*.wav;*.wma)|*.aac;*.flac;*.m4a;*.mp3;*.mp4;*.ogg;*.wav;*.wma",
         Multiselect = true,
     };
     if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         string Error_File = "";
         foreach (string File_Now in ofd.FileNames)
         {
             bool IsExist = false;
             foreach (string File_Temp in SE_Files[SE_List.SelectedIndex])
             {
                 if (File_Temp == File_Now)
                 {
                     if (Error_File == "")
                     {
                         Error_File = Path.GetFileName(File_Now);
                     }
                     else
                     {
                         Error_File += "\n" + Path.GetFileName(File_Now);
                     }
                     IsExist = true;
                     break;
                 }
             }
             if (IsExist)
             {
                 continue;
             }
             SE_Files[SE_List.SelectedIndex].Add(File_Now);
             SE_Sound_List.Items.Add(Path.GetFileName(File_Now));
         }
         if (Error_File != "")
         {
             MessageBox.Show("以下のファイルは既に追加されているため処理できませんでした。\n" + Error_File);
         }
     }
     ofd.Dispose();
 }
        private void LoadPracticalFileExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog();
            ofd.Filter      = "题库文件|*.sub";
            ofd.Multiselect = false;

            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                LoadPractical(ofd.FileName);
            }

            ofd.Dispose();
        }
 static void TESTSUB_OpenDialogResource(MyTranslateResourceLow trans)
 {
     foreach (var pair in trans.Dic)
     {
         if (pair.Key.IndexOf("All files") < 0)
         {
             continue;
         }
         System.Windows.Forms.OpenFileDialog open = new System.Windows.Forms.OpenFileDialog();
         open.Filter = pair.Value;
         open.Dispose();
     }
 }
Exemple #13
0
            /// <summary>
            /// 返回用户选择的文件路径
            /// </summary>
            /// <returns></returns>
            public string UserSelectFile()
            {
                string res = "";

                System.Windows.Forms.FileDialog file = new System.Windows.Forms.OpenFileDialog();
                file.ShowDialog();
                if (!file.FileName.Equals(""))
                {
                    FileInfo fileInfo = new FileInfo(file.FileName);
                    file.Dispose();
                    res = fileInfo.FullName;
                }
                return(res);
            }
        public void AddImageAction()
        {
            System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
            dlg.Filter = "Images|*.png;*.gif;*.jpg";

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string[]     filePath = dlg.FileNames;
                StreamReader sr       = new StreamReader(filePath[0]);
                BinaryReader read     = new BinaryReader(sr.BaseStream);
                Pict = read.ReadBytes((int)sr.BaseStream.Length);
            }
            dlg.Dispose();
        }
        /// <summary>
        ///
        /// </summary>
        private void OpenProject()
        {
            SaveChangesOnDemand();

            System.Windows.Forms.OpenFileDialog form = new System.Windows.Forms.OpenFileDialog();
            form.Filter      = "Xml files (*.xml)|*.xml";
            form.Multiselect = false;

            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                LoadFile(form.FileName);
            }

            form.Dispose();
        }
Exemple #16
0
        private void btnMediaLocation_Click(object sender, RoutedEventArgs e)
        {
            var dlg = new System.Windows.Forms.OpenFileDialog()
            {
                Filter           = "Media Files|*.wav;*.mp3;*.flac;*.mp4;*.avi;*.flv",
                InitialDirectory = Settings.LastMediaLocation,
                Title            = "Load Media"
            };
            var res = dlg.ShowDialog();

            if (res == System.Windows.Forms.DialogResult.OK)
            {
                MediaLocation = dlg.FileName;
            }
            dlg.Dispose();
        }
Exemple #17
0
        public void SelectFile(ObjectRequest objectRequest)
        {
            using (System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog())
            {
                if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    String filePath   = openFileDialog.FileName;
                    String fileName   = Path.GetFileName(filePath);
                    String fileParent = Path.GetDirectoryName(filePath);
                    String pattern    = Regex.Replace(fileName, "_[0-1]?[0-9].pkg", "_[0-1]?[0-9].pkg");

                    if (!objectRequest.PsnName.ToUpper().Equals(fileName.ToUpper()))
                    {
                        if (new DialogMessage(_view.TryFindResource("StrOpenInconsistent") as String, String.Empty, DialogMessage.Buttons.YesNo)
                        {
                            Owner = _view
                        }.ShowDialog() == true)
                        {
                            HistoryReocrds.Add(objectRequest.PsnPath, filePath);
                            objectRequest.LocalPath = filePath;
                        }
                        else
                        {
                            return;
                        }
                    }
                    else if (Regex.IsMatch(filePath, "_[0-1]?[0-9].pkg", RegexOptions.IgnoreCase) && new DialogMessage(_view.TryFindResource("StrOpenRelated") as String, String.Empty, DialogMessage.Buttons.YesNo)
                    {
                        Owner = _view
                    }.ShowDialog() == true)
                    {
                        Dictionary <String, String> matches = Directory.GetFiles(fileParent)
                                                              .Where(path => Regex.IsMatch(path, pattern, RegexOptions.IgnoreCase))
                                                              .ToDictionary(localFilePath => objectRequest.PsnPath.Replace(fileName, Path.GetFileName(localFilePath)), localFilePath => localFilePath);
                        HistoryReocrds.AddAll(matches);
                    }
                    else
                    {
                        HistoryReocrds.Add(objectRequest.PsnPath, filePath);
                    }
                    objectRequest.LocalPath = filePath;
                }
                openFileDialog.Dispose();
            }
        }
Exemple #18
0
        private void BtSetPath_Click(object sender, RoutedEventArgs e)
        {
            if ((bool)!cbBrowseFile.IsChecked)
            {
                System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog
                {
                    Description         = "Select Folder to be installonized:",
                    ShowNewFolderButton = false,
                    RootFolder          = Environment.SpecialFolder.UserProfile
                };

                if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    filename    = Path.GetFileNameWithoutExtension(dialog.SelectedPath);
                    tbPath.Text = dialog.SelectedPath;
                    setFileType = FileType.Directory;
                }
                dialog.Dispose();
            }
            else
            {
                System.Windows.Forms.OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog()
                {
                    Title  = "Select File to be installonized",
                    Filter = "Executables and Batch Files (*.exe, *.bat)|*.exe;*.bat|All Files (*.*)|*.*"
                };

                if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    filename    = Path.GetFileNameWithoutExtension(dialog.FileName);
                    filenameExt = Path.GetFileName(dialog.FileName);
                    tbPath.Text = dialog.FileName;

                    if (Path.GetExtension(dialog.FileName) == ".exe" || Path.GetExtension(dialog.FileName) == ".bat")
                    {
                        setFileType = FileType.Executable;
                    }
                    else
                    {
                        setFileType = FileType.Other;
                    }
                }
                dialog.Dispose();
            }
        }
Exemple #19
0
 /// <summary>
 /// 用户选择多个文件路径
 /// </summary>
 /// <param name="filesInfo">得到的结果将传递至此</param>
 public void UserSelectFile(ref List <string> filesInfo)
 {
     System.Windows.Forms.OpenFileDialog file = new System.Windows.Forms.OpenFileDialog
     {
         Multiselect = true
     };
     file.ShowDialog();
     string[] filepath = file.FileNames;
     file.Dispose();
     if (filepath.Length != 0)
     {
         foreach (string x in filepath)
         {
             FileInfo fileInfo = new FileInfo(x);
             filesInfo.Add(fileInfo.FullName);
         }
     }
 }
Exemple #20
0
        /// <summary>
        /// Select the images to convert using a file dialog
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ImgViewer_MouseDown_SelectImages(object sender, MouseButtonEventArgs e)
        {
            if (local_pathsOfImagesToConvert.Count != 0) //Disable the selection of images if there are already some images to convert
            {
                return;
            }

            // "PNG", "JPG", "JPEG", "BMP", "GIF", "ICO", "CUR", "TIFF"
            System.Windows.Forms.OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog();
            string images = "";

            if (Settings.Default.Language == "it")
            {
                dialog.Title = LanguageManager.IT_OpenFileDialogTitle; images = LanguageManager.IT_Images;
            }
            else if (Settings.Default.Language == "en")
            {
                dialog.Title = LanguageManager.EN_OpenFileDialogTitle; images = LanguageManager.EN_Images;
            }

            dialog.Filter = $"{images}|*.png; *.jpg; *.jpeg; *.bmp; *.gif; *.ico; *.cur; *.tiff|"
                            + "Png|*.png|"
                            + "Jpg|*.jpg|"
                            + "Jpeg|*.jpeg|"
                            + "Bmp|*.bmp|"
                            + "Gif|*.gif|"
                            + "Ico|*.ico|"
                            + "Cur|*.cur|"
                            + "Tiff|*.tiff";
            dialog.DereferenceLinks = true;
            dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            dialog.Multiselect      = true;
            System.Windows.Forms.DialogResult result = dialog.ShowDialog();

            if (result != System.Windows.Forms.DialogResult.Cancel)
            {
                local_pathsOfImagesToConvert = GetImagesToConvertAndPrepareGUI(dialog.FileNames.ToList());
                LoadPreviewImage(local_pathsOfImagesToConvert);
            }
            dialog.Dispose();
            GC.Collect();
            StartConversionBttn.IsEnabled = true;
        }
 private void OpenFileDialogExecuted(object sender, ExecutedRoutedEventArgs e)
 {
     System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog();
     ofd.Filter      = "Excel文件|*.xls";
     ofd.Multiselect = true;
     if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         for (int i = 0; i < ofd.FileNames.Length; i++)
         {
             PracticalFile file = new PracticalFile();
             file.Path   = ofd.FileNames[i];
             file.Name   = System.IO.Path.GetFileNameWithoutExtension(ofd.FileNames[i]);
             file.Index  = files.Count;
             file.IsLast = i == ofd.FileNames.Length - 1;
             files.Add(file);
         }
     }
     ofd.Dispose();
 }
Exemple #22
0
 public static string OpenFile()
 {
     System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
     dlg.Title  = "Choose an image file";
     dlg.Filter = "Bitmap files (*.bmp)|*.bmp|JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|PNG (*.png)|*.png|All files (*.*)|*.*";
     try
     {
         if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             dlg.Dispose();
             return(dlg.FileName);
         }
     }
     catch (Exception ex)
     {
         System.Windows.Forms.MessageBox.Show("Error: Could not read file from disk.\nOriginal error: " + ex.Message);
     }
     return("");
 }
Exemple #23
0
            /// <summary>
            /// 用户选择单个文件路径
            /// </summary>
            /// <param name="extension">特定的后缀  ex:".exe"</param>
            /// <returns></returns>
            public string UserSelectFile(string[] extension)
            {
                string res = "!";

                System.Windows.Forms.FileDialog file = new System.Windows.Forms.OpenFileDialog();
                file.ShowDialog();
                if (!file.FileName.Equals(""))
                {
                    FileInfo fileInfo = new FileInfo(file.FileName);
                    file.Dispose();
                    for (int i = 0; i < extension.Length; i++)
                    {
                        if (fileInfo.Extension.Equals(extension[i]))
                        {
                            res = fileInfo.FullName;
                        }
                    }
                }
                return(res);
            }
Exemple #24
0
        private void OpenFileDialogMessage_Received(OpenFileDialogMessage message)
        {
            if (message.Sender != DataContext)
            {
                return;
            }

            var dialog = new System.Windows.Forms.OpenFileDialog
            {
                Filter           = message.Filter,
                FileName         = message.FileName,
                RestoreDirectory = true
            };

            message.Result = dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK;
            if (message.Result)
            {
                message.FileName = dialog.FileName;
            }
            dialog.Dispose();
        }
        private void OnImportBackgroundClicked(object sender, EventArgs e)
        {
            var fileDialog = new System.Windows.Forms.OpenFileDialog()
            {
                Filter = "Images|*.jpg;*.jpeg;*.png;*.bmp",
            };

            if (fileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var backgroundDialog = Injector.GetInstance <BackgroundImporterView>();
                backgroundDialog.SetBitmap(new BitmapImage(new Uri(fileDialog.FileName)));

                if (backgroundDialog.ShowDialog() == true)
                {
                    DispatchEvent(new ImportBackgroundEventArgs(EVENT_IMPORT_BACKGROUND, backgroundDialog.BackgroundName,
                                                                backgroundDialog.BackgroundLayout, backgroundDialog.CropRect, fileDialog.FileName));
                }
            }

            fileDialog.Dispose();
        }
        /// <summary>
        /// Zdarzenie wybierania ścieżki do pliku graficznego.
        /// </summary>
        private void SourceButton_OnClick(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog
            {
                Title  = @"Otwórz plik",
                Filter = filtrRozszerzen
            };

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (File.Exists(dlg.FileName))
                {
                    model.SciezkaPliku = dlg.FileName;
                }
                else
                {
                    MessageBox.Show("Podany plik nie istnieje.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            dlg.Dispose();
        }
        private async void Change_Name_B_Click(object sender, RoutedEventArgs e)
        {
            if (IsClosing || IsBusy)
            {
                return;
            }
            System.Windows.Forms.OpenFileDialog ofd1 = new System.Windows.Forms.OpenFileDialog()
            {
                Title       = "移植元のActor-Mixer Hierarchyを選択してください。",
                Multiselect = false,
                Filter      = "Actor-Mixer Hierarchy(*.wwu)|*.wwu"
            };
            if (ofd1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                System.Windows.Forms.OpenFileDialog ofd2 = new System.Windows.Forms.OpenFileDialog()
                {
                    Title       = "移植先のActor-Mixer Hierarchyを選択してください。",
                    Multiselect = false,
                    Filter      = "Actor-Mixer Hierarchy(*.wwu)|*.wwu"
                };
                if (ofd2.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    if (ofd1.FileName == ofd2.FileName)
                    {
                        MessageBox.Show("移植元と移植先のファイルが同じです。");
                    }
                    else
                    {
                        Message_T.Text = "名前空間を移植しています...";
                        await Task.Delay(50);

                        Wwise_Project_Change_Name(ofd1.FileName, ofd2.FileName);
                        Message_Feed_Out("名前空間の移植が完了しました。");
                    }
                }
                ofd2.Dispose();
            }
            ofd1.Dispose();
        }
 private void OpenFileDialogExecuted(object sender, ExecutedRoutedEventArgs e)
 {
     System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog();
     ofd.Filter      = "实操文件|*.prac";
     ofd.Multiselect = false;
     if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         try
         {
             practicalFilePath = ofd.FileName;
             studentInfo.SetBinding(Panel.DataContextProperty, new Binding(".")
             {
                 Source = Load(practicalFilePath)
             });
         }
         catch
         {
             MessageBox.Show("读取失败。");
         }
     }
     ofd.Dispose();
 }
Exemple #29
0
        private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
            if (GetKey() == String.Empty)
            {
                return;
            }
            System.Windows.Forms.OpenFileDialog openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            openFileDialog1.Filter = QiniuUtil.GetFileFilter(UploadType);

            openFileDialog1.Multiselect = false;

            var re = openFileDialog1.ShowDialog();

            if (re == System.Windows.Forms.DialogResult.OK)
            {
                var    file    = openFileDialog1.FileName;
                string filekey = string.Format("{0}{1}", GetKey(), System.IO.Path.GetExtension(file));

                try
                {
                    openFileDialog1.Dispose();
                    this.ProBar.Visibility = Visibility.Visible;
                    Dowork     dowork = DoUploadData;
                    UploadData data   = new UploadData();
                    data.Dir        = UploadType;
                    data.FileKey    = filekey;
                    data.Fpath      = file;
                    data.IsOverride = _isOverride;
                    data.ProAction  = OnProgress;

                    dowork.BeginInvoke(data, Callback, dowork);
                }
                catch (Exception ex)
                {
                    Trace.WriteLine(ex);
                }
            }
        }
Exemple #30
0
        public static ActionResult CustomAction3(Session session)
        {
            System.Windows.Forms.OpenFileDialog openFileDialog = null;

            try
            {
                var thread = new Thread(
                    () =>
                {
                    using (openFileDialog = new System.Windows.Forms.OpenFileDialog())
                        openFileDialog.CheckPathExists = true;
                    openFileDialog.CheckFileExists = true;
                    openFileDialog.Filter          = "Image Files|*.jpg;*.jpeg;*.png;*.bmp;";
                    openFileDialog.DefaultExt      = "*. *";

                    if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        session["IMGPATH"] = openFileDialog.FileName;
                    }

                    if (openFileDialog != null)
                    {
                        openFileDialog.Dispose();
                    }
                });
                thread.SetApartmentState(ApartmentState.STA);
                thread.Start();
                thread.Join();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.ToString());
            }


            return(ActionResult.Success);
        }
Exemple #31
0
        private void MenuItem_Click_4_1(object sender, RoutedEventArgs e)
        {
            // 고객 excel로 추가
            System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog();
            openFileDialog.Multiselect = false;
            openFileDialog.Filter = "Excel 97-2013|*.xls";
            openFileDialog.FilterIndex = 1;
            openFileDialog.ShowDialog();

            string xlsfilename = openFileDialog.FileName;

            if (string.IsNullOrEmpty(xlsfilename))
                return;

            openFileDialog.Dispose();

            DataSet ds = ExcelHelper.OpenExcelDB(xlsfilename);

            if (ds != null)
            {
                if (ds.Tables.Count == 1)
                {
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        Customer _customer = new Customer() {
                            Group_Name = row[0].ToString().Trim(),
                            Name = row[1].ToString().Trim(),
                            Company = row[2].ToString().Trim(),
                            Title = row[3].ToString().Trim(),
                            Tel = row[4].ToString().Trim(),
                            Cellular = row[5].ToString().Trim(),
                            Extension = row[6].ToString().Trim(),
                            Email = row[7].ToString().Trim(),
                            Addr = row[8].ToString().Trim()
                        };
                        customers.importExcel(_customer);
                    }
                }
            }
        }
        public void AddImageAction()
        {
            System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
            dlg.Filter = "Images|*.png;*.gif;*.jpg";

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string[] filePath = dlg.FileNames;
                StreamReader  sr = new StreamReader(filePath[0]);
                BinaryReader read = new BinaryReader(sr.BaseStream);
                Pict = read.ReadBytes((int)sr.BaseStream.Length);

            }
            dlg.Dispose();
        }
        private async void UploadNewAvatar(object sender, MouseButtonEventArgs e)
        {
            var dialog = new System.Windows.Forms.OpenFileDialog
                             {
                                 DefaultExt = ".png",
                                 InitialDirectory = Environment.SpecialFolder.MyPictures.ToString(),
                                 Title = "Select a new avatar",
                                 Filter = "Image files | *.png; *.jpg; *.bmp"
                             };
            dialog.ShowDialog();

            var mimeType = "image/";

            if (String.IsNullOrEmpty(dialog.FileName)) return;
            if (dialog.SafeFileName == null) return;

            if (dialog.SafeFileName.EndsWith(".png")) mimeType += "png";
            else if (dialog.SafeFileName.ToLower().EndsWith(".jpg")) mimeType += "jpg";
            else if (dialog.SafeFileName.EndsWith(".bmp")) mimeType += "bmp";
            else
            {
                dialog.Dispose();
                App.Connection.NotificationController.Notification.Notify("That's not a supported file type! Please try again.");
                return;
            }

            await App.Connection.SessionController.CurrentSession.UploadAvatar(
                new FileStream(dialog.FileName, FileMode.Open), mimeType);
            dialog.Dispose();
            
        }
Exemple #34
0
        /// <summary>
        /// 
        /// </summary>
        private void OpenProject()
        {
            SaveChangesOnDemand();

            System.Windows.Forms.OpenFileDialog form = new System.Windows.Forms.OpenFileDialog();
            form.Filter = "Xml files (*.xml)|*.xml";
            form.Multiselect = false;

            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                LoadFile(form.FileName);
            }

            form.Dispose();
        }
        public void AddImageAction()
        {
            System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
            dlg.Filter = "Images|*.png;*.gif;*.jpg";

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string[] filePath = dlg.FileNames;
                StreamReader sr = new StreamReader(filePath[0]);
                BinaryReader read = new BinaryReader(sr.BaseStream);
                byte[] Pict = read.ReadBytes((int)sr.BaseStream.Length);

                MemoryStream stream = new MemoryStream(Pict);
                stream.Position = 0;
                BitmapImage bi = new BitmapImage();
                bi.BeginInit();
                bi.StreamSource = stream;
                bi.EndInit();

                ImageSource imgsrc = bi;
                Image newimg = new Image();
                newimg.Source = imgsrc;

                ObservableCollection<Image> listimage = new ObservableCollection<Image>();
                foreach (Image img in Pictures)
                {
                    listimage.Add(img);
                }

                listimage.Add(newimg);
                Pictures = listimage;
            }
            dlg.Dispose();
        }
        public static ActionResult CustomAction3(Session session)
        {
            System.Windows.Forms.OpenFileDialog openFileDialog = null;

            try
            {

                var thread = new Thread(
                    () =>
                    {

                        using (openFileDialog = new System.Windows.Forms.OpenFileDialog())
                            openFileDialog.CheckPathExists = true;
                        openFileDialog.CheckFileExists = true;
                        openFileDialog.Filter = "Image Files|*.jpg;*.jpeg;*.png;*.bmp;";
                        openFileDialog.DefaultExt = "*. *";

                        if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            session["IMGPATH"] = openFileDialog.FileName;

                        }

                        if (openFileDialog != null)
                        {
                            openFileDialog.Dispose();
                        }
                    });
                thread.SetApartmentState(ApartmentState.STA);
                thread.Start();
                thread.Join();

            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.ToString());
            }

            return ActionResult.Success;
        }