Example #1
0
        public string _ouvrir(typeFichier tf)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            if (tf == typeFichier.musique)
            {
                ofd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic);
                ofd.Filter = "mp3 files (*.mp3)|*.mp3";
                ofd.FilterIndex = 2;
                ofd.RestoreDirectory = true;

                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    if (ofd.OpenFile() != null)
                    {
                        try
                        {
                            Lecteur = new Audio(ofd.FileName, false);

                        }
                        catch (Exception esx)
                        {
                            MessageBox.Show("Fichier non reconnu." + esx.HResult);
                            return null;
                        }

                        return ofd.FileName;

                    }
                }
                return null;
            }
            else if (tf == typeFichier.image)
            {
                ofd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
                ofd.Filter = "JPG (*.jpg)|*.jpg";
                ofd.FilterIndex = 2;
                ofd.RestoreDirectory = true;

                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        if (ofd.OpenFile() != null)// On attribue le chemin du fichier à lire au
                        {

                            return ofd.FileName;

                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
                        return null;
                    }
                }
                return null;

            }
            return null;
        }
 private void Template_Click(object sender, RoutedEventArgs e)
 {
     template_ofd = new OpenFileDialog();
     template_ofd.FileName = "";
     template_ofd.DefaultExt = "*.*";
     template_ofd.ShowDialog();
 }
 private void Screen_Click(object sender, RoutedEventArgs e)
 {
     screen_ofd = new OpenFileDialog();
     screen_ofd.FileName = "";
     screen_ofd.DefaultExt = "*.*";
     screen_ofd.ShowDialog();
 }
Example #4
0
 public void databind()
 {
     cboxLoadOnStartup.IsChecked = this.ApplicationSettings.LoadOnStartUp;
     cboxStartMinimized.IsChecked = this.ApplicationSettings.StartMinimized;
     cboxCheckForUpdates.IsChecked = this.ApplicationSettings.CheckForUpdates;
     //
     this.cboxLanguages_databind();
     //
     txtBrowser.Text = this.ApplicationSettings.BrowserFileInfo.FullName;
     btnBrowseBrowser.Click += delegate(object sender, RoutedEventArgs e) {
         FileDialog fDialog = new OpenFileDialog();
         DialogResult dResult = fDialog.ShowDialog();
         if (dResult == DialogResult.OK) {
             this.ApplicationSettings.BrowserFileInfo = new FileInfo(fDialog.FileName);
             txtBrowser.Text = this.ApplicationSettings.BrowserFileInfo.FullName;
         }
     };
     //
     txtTempFolder.Text = this.ApplicationSettings.TempDirectory.FullName;
     btnBrowseTempFolder.Click += delegate(object sender, RoutedEventArgs e) {
         FolderBrowserDialog fBrowser = new FolderBrowserDialog();
         DialogResult dResult = fBrowser.ShowDialog();
         if (dResult == DialogResult.OK) {
             this.ApplicationSettings.TempDirectory = new DirectoryInfo(fBrowser.SelectedPath);
             txtTempFolder.Text = this.ApplicationSettings.TempDirectory.FullName;
         }
     };
 }
    public void Function()
    {
        string strProjectpath =
            PathMap.SubstitutePath("$(PROJECTPATH)") + @"\";
        string strFilename = "Testdatei";

        OpenFileDialog ofd = new OpenFileDialog();
        ofd.DefaultExt = "txt";
        ofd.FileName = strFilename;
        ofd.Filter = "Testdatei (*Testdatei*.txt)"
            + "|*Testdatei*.txt|Alle Dateien (*.*)|*.*";
        ofd.InitialDirectory = strProjectpath;
        ofd.Title = "Testdatei auswählen:";
        ofd.ValidateNames = true;

        if (ofd.ShowDialog() == DialogResult.OK)
        {
            strFilename = ofd.FileName;
            MessageBox.Show(
                "Der Speicherort wurde erfolgreich übergeben:\n"
                + strFilename,
                "Information",
                MessageBoxButtons.OK,
                MessageBoxIcon.Information
                );
        }

        return;
    }
Example #6
0
 private void LoadPlugin_Click(object sender, RoutedEventArgs e)
 {
     OpenFileDialog ofd = new OpenFileDialog();
     ofd.Filter = "Plugins (*.dll)|*.dll|All Files (*.*)|*.*";
     if (ofd.ShowDialog() != DialogResult.Cancel)
         host.Project.LoadAssembly(Assembly.LoadFile(ofd.FileName), true);
 }
Example #7
0
    private void button1_Click(object sender, EventArgs e)
    {
        OpenFileDialog fileDialog = new OpenFileDialog();

        //判断用户是否正确的选择了文件
        if (fileDialog.ShowDialog() == DialogResult.OK)
        {
            FileInfo fileInfo = new FileInfo(fileDialog.FileName);
            label4.Text = fileInfo.ToString();
            button1.Visible = false;

            string str;
            StreamReader reader = new StreamReader(fileInfo.ToString(), Encoding.Default);
            if ((str = reader.ReadLine()) != null)
            {
                string[] strArray = str.Split(new char[] { '&' });
                Class1 method = new Class1();
                if (strArray.Length == 3)
                {

                    label5.Text = "CPU:" + method.Decrypto(strArray[0].ToString());
                    label6.Text = "磁盘:" + method.Decrypto(strArray[1].ToString());
                    label7.Text = "mac地址:" + method.Decrypto(strArray[2].ToString());
                }

            }
        }
    }
Example #8
0
    private void btnSoundfile_Click(object sender, System.EventArgs e)
    {
        OpenFileDialog ofd = new OpenFileDialog();

        if(string.Empty == PathSoundFile)
               PathSoundFile = Utility.SdkMediaPath;

        ofd.InitialDirectory = PathSoundFile;
        ofd.Filter=  "Wave files(*.wav)|*.wav";

        if( DialogResult.Cancel == ofd.ShowDialog() )
            return;

        if(LoadSoundFile(ofd.FileName))
        {
            PathSoundFile = Path.GetDirectoryName(ofd.FileName);
            lblFilename.Text = Path.GetFileName(ofd.FileName);
            EnablePlayUI(true);
        }
        else
        {
            lblFilename.Text = "No file loaded.";
            EnablePlayUI(false);
        }
    }
Example #9
0
    //konstruktor wczytujący kalendarz z pliku
    public Aplikacja()
    {
        kalendarz = new Kalendarz();
        data = new Data_dzien();
        while (data.DzienTygodnia() != DniTygodnia.poniedziałek) { data--; }

        //inicjalizacja OpenFileDialog
        otwórz_plik = new OpenFileDialog();
        otwórz_plik.InitialDirectory = "c:\\";
        otwórz_plik.FileName = "";
        otwórz_plik.Filter = "pliki Kalendarza (*.kalen)|*.kalen|All files (*.*)|*.*";
        otwórz_plik.FilterIndex = 2;
        otwórz_plik.RestoreDirectory = true;
        //**************KONIEC INICJALIZACJI OpenFileDialog**************

        //inicjalizacja SaveFileDialog
        zapisz_plik = new SaveFileDialog();
        zapisz_plik.AddExtension = true;
        zapisz_plik.FileName = "";
        zapisz_plik.InitialDirectory = "c:\\";
        zapisz_plik.Filter = "pliki Kalendarza (*.kalen)|*.kalen|All files (*.*)|*.*";
        zapisz_plik.FilterIndex = 1;
        zapisz_plik.RestoreDirectory = true;
        //**************KONIEC INICJALIZACJI SaveFileDialog**************

        if (otwórz_plik.ShowDialog() == DialogResult.OK)
        {
            Stream plik = otwórz_plik.OpenFile();
            kalendarz.Wczytaj(plik);
            plik.Flush();
            plik.Close();
        }
    }
Example #10
0
 private void butJavawBrowse_Click(object sender, RoutedEventArgs e)
 {
     FileDialog dialog = new OpenFileDialog();
     dialog.Filter = "javaw.exe | javaw.exe";
     dialog.ShowDialog();
     comboJava.Text = dialog.FileName;
 }
        private void ButtonAddPhoto_Click(object sender, RoutedEventArgs e)
        {
            FullGrid.Visibility = Visibility.Hidden;
            AnimationLoading.Visibility = Visibility.Visible;
            var dlg = new OpenFileDialog
            {
                InitialDirectory = @"c:\\",
                Filter = @"Image files (*.jpg)|*.jpg",
                RestoreDirectory = true
            };
            var bitmap = new BitmapImage();

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                _filepath = dlg.FileName;
                bitmap.BeginInit();
                bitmap.UriSource = new Uri(_filepath);
                bitmap.EndInit();
                _hashfile = AppDomain.CurrentDomain.BaseDirectory + @"Temp\" + @"Visit\" + _i + @".jpg";
                File.Copy(_filepath, _hashfile);
                Picture.CollectionLoadPhoto.Add(new Picture(new BitmapImage(new Uri(_filepath)), _i + @".jpg"));
                _i++;
                ListBoxPhoto.ItemsSource = Picture.CollectionLoadPhoto;
                ListBoxPhoto.Visibility = Visibility.Visible;
            }
            AnimationLoading.Visibility = Visibility.Hidden;
            FullGrid.Visibility = Visibility.Visible;
        }
Example #12
0
        private string LoadFile()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            string directory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);

            openFileDialog.InitialDirectory = directory;
            openFileDialog.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
            openFileDialog.FilterIndex = 1;
            openFileDialog.RestoreDirectory = true;
            openFileDialog.Title = "Please Select the Shared Parameter File";

            string filename = null;
            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                filename = openFileDialog.FileName;
                if(File.Exists(filename))
                {
                    return filename;
                }
                else
                {
                    return null;
                }
            }
            return filename;
        }
Example #13
0
        private void ButtonSelectFile_Click(object sender, RoutedEventArgs e)
        {
            var dlg = new OpenFileDialog();

            // Set filter for file extension and default file extension
            dlg.Title = "Select csv file";
            dlg.DefaultExt = ".csv";
            dlg.Filter = "Text Files (.csv)|*.csv";

            // Display OpenFileDialog by calling ShowDialog method
            var result = dlg.ShowDialog();

            // Get the selected file name and display in a TextBox
            if (result == System.Windows.Forms.DialogResult.OK)
            {
                // Open document
                var filename = dlg.FileName;
                using (var sr = new StreamReader(filename, Encoding.UTF8))
                {
                    CsvTable = new DataTable();
                    var csvReader = new CsvReader(sr, true);
                    CsvTable.Load(csvReader);
                    DataGridCsvTable.ItemsSource = CsvTable.DefaultView;
                }
            }
        }
Example #14
0
        private void bload_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofdialog = new OpenFileDialog();
            ofdialog.CheckFileExists = true;
            ofdialog.Filter = "eXtensible Markup Language Files|*.xml";
            ofdialog.Title = "Select XML playlist file !";
            ofdialog.Multiselect = false;
            ofdialog.InitialDirectory = "U:\\stravos\\DOTNET\\wpf\\wpf";
            ofdialog.ShowDialog();

            try
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(ofdialog.FileName);

                XmlDataProvider prov = new XmlDataProvider();
                prov.Document = doc;
                prov.XPath = "/songs/song";

                plist.DataContext = prov;
            }
            catch (Exception ex)
            {
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {

            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = "(*.c;*.cpp;*.java;*.cs;)|*.c;*.cpp;*.java;*.cs|" + "All files (*.*)|*.*";
            ofd.Multiselect = true;
            // Show the dialog and get result.
            DialogResult result = ofd.ShowDialog();
           // Console.WriteLine(result);

            if (result.ToString() == "OK") // Test result.
            {
                bfile.Content = "add more file";
                bfile.Width = 110;
                path = ofd.FileNames;
               // Console.WriteLine(path[0]);
                FileInfo x = new FileInfo(path[0]);
                DirectoryInfo dir = x.Directory;
                nev.Text = dir.ToString();
                foreach (string s in path)
                {
                   // Console.WriteLine(s);
                    pathg.Add(s);
                }
   
            }
            

        }
Example #16
0
        private void Browse_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            System.Windows.Forms.DialogResult result = dlg.ShowDialog();
            if (result == System.Windows.Forms.DialogResult.OK)
            {
                string filename = dlg.FileName;
                FileInfo info = new FileInfo(filename);
                if (!info.Exists)
                {
                    RunButton.IsEnabled = false;
                }
                else
                {
                    RunButton.IsEnabled = true;
                    PathBox.Text = info.FullName;

                    try
                    {
                        Image<Bgr, Byte> table = new Image<Bgr, byte>(info.FullName);
                        ImageSource bitmap = TreeViz.ToBitmapSource(table.PyrDown().PyrDown());
                        Shower.Source = bitmap;
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
        }
Example #17
0
    // Use this for initialization
    void Start()
    {
        loadingText = GameObject.Find("LoadingText").GetComponent<Text>();

        //BMSE Argument
        string[] args = Environment.GetCommandLineArgs();
        if(args.Length != 0)
        {
            Debug.Log(args[args.Length - 1]);
            path = args[args.Length - 1];

            if (File.Exists(path))
            {
                StartCoroutine("LoadMain");
                return;
            }

        }
        //Open without argument
        while (!File.Exists(path))
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.Filter = "BMS Files|*.bms;*.bme;*.bml;*.pms";
            openFileDialog.Title = "Select a BMS File";
            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                path = openFileDialog.FileName;
            }
        }
        StartCoroutine("LoadMain");
    }
 private void BrowseButton_OnClick(object sender, RoutedEventArgs e)
 {
     OpenFileDialog dialog = new OpenFileDialog();
     DialogResult dialogResult = dialog.ShowDialog();
     if (dialogResult == System.Windows.Forms.DialogResult.OK)
     {
         viewModel.InputFileName = dialog.FileName;
     }
 }
Example #19
0
 private void addonimagebrowsebutton_Click(object sender, RoutedEventArgs e)
 {
     OpenFileDialog dialog = new OpenFileDialog();
     dialog.Filter = "JPEG File (.jpg)|*.jpg";
     dialog.Multiselect = false;
     dialog.ShowDialog();
     addonimagepath = dialog.FileName;
     selectAddonImageBox.Text = addonimagepath;
 }
Example #20
0
 private void btnBrowse_Click(object sender, System.EventArgs e)
 {
     System.Windows.Forms.OpenFileDialog oDialog = new OpenFileDialog();
         if (oDialog.ShowDialog() == DialogResult.OK)
         {
             filename = oDialog.FileName;
             this.txtPath.Text = filename;
         }
 }
Example #21
0
	/// <summary>
	///     Выбор файла с аккаунтами
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void btAcc_Click(object sender, EventArgs e)
	{
		var openDialog = new OpenFileDialog {Filter = @"Файл c аккаунтами|*.txt"};
		DialogResult result = openDialog.ShowDialog();
		if (result == DialogResult.OK)
		{
			tbAcc.Text = openDialog.FileName;
		}
	}
Example #22
0
        protected void Open_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();
            dlg.Multiselect = false;
            if (dlg.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                return;

            this.OpenDBFFile(dlg.FileName);
        }
        private void btnInputBrowse_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.CheckFileExists = true;
            ofd.CheckPathExists = true;

            if (ofd.ShowDialog() == DialogResult.OK)
                tbInputFile.Text = ofd.FileName;
        }
        private void ButtonOpenFile_Click(object sender, RoutedEventArgs e)
        {
            var file = new OpenFileDialog();
            var result = file.ShowDialog();

            this.TextBoxLocationFile.Text = System.IO.Path.GetFullPath(file.FileName);

            _censorFile = ReadFileLines(file.FileName);
        }
Example #25
0
        private void btnChooseFile_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            if (openFileDialog.ShowDialog() != DialogResult.OK) return;

            model.ImportPath = openFileDialog.FileName;
            txtFilePath.Text = model.ImportPath;
        }
 void FileOpenDlg(object obj, EventArgs args)
 {
     OpenFileDialog dlg = new OpenFileDialog();
     dlg.Title = "파일 선택";
     if (dlg.ShowDialog() == DialogResult.OK)
     {
         MessageBox.Show(dlg.FileName + " : 파일 선택");
     }
 }
Example #27
0
    public void OnLengthClick(object sender, EventArgs e)
    {
        OpenFileDialog dialog = new OpenFileDialog();
        dialog.Filter = "txt files (*.txt)|*.txt";

        if (dialog.ShowDialog(this) == DialogResult.OK) {
          FileSorter.SortByLength(dialog.FileName);
        }
    }
 private void btn_Browse_Click(object sender, RoutedEventArgs e)
 {
     OpenFileDialog ofd = new OpenFileDialog();
     ofd.Title = "Select a File to Validate";
     if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         validate(ofd.FileName);
     }
 }
Example #29
0
	/// <summary>
	///     Выбор файла конфигурации
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void btConfig_Click(object sender, EventArgs e)
	{
		var openDialog = new OpenFileDialog {Filter = @"Файл конфигурации|*.php"};
		DialogResult result = openDialog.ShowDialog();
		if (result == DialogResult.OK)
		{
			tbConfig.Text = openDialog.FileName;
		}
	}
 private void BrowseFileOnClick(object sender, RoutedEventArgs e)
 {
     OpenFileDialog dialog = new OpenFileDialog();
     DialogResult result = dialog.ShowDialog();
     if (result == DialogResult.OK)
     {
         this.viewModel.InputFile = dialog.FileName;
     }
 }
        private static string PromptOpenExcelFileName()
        {
            var dialog = new OpenFileDialog()
            {
                DefaultExt = ".xlsx",
                Filter     = "Excel/CSV files (*.xlsx;*.xls;*.csv)|*.xlsx;*.xls;*.csv|All files (*.*)|*.*"
            };

            /* Display the dialog and return the text entered by the user */
            return(dialog?.ShowDialog() == true
                ? dialog.FileName
                : string.Empty);
        }
        public void AddLogo()
        {
            var openFileDialog = new OpenFileDialog
            {
                Title            = "Kanal İçin Logo Seçin",
                Filter           = Settings.ImageFilter,
                InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
            };

            if (openFileDialog?.ShowDialog() == true)
            {
                Channel.Logo = openFileDialog.FileName.PathToBitmapImage();
            }
        }
Example #33
0
        private async void LoadButtonEvent(object sender, EventArgs e)
        {
            if (openFileDialog1?.ShowDialog() == DialogResult.OK)
            {
                var  fileInfo = new FileInfo(openFileDialog1.FileName);
                bool loadFile = true;
                if (fileInfo.Length > 1e7)
                {
                    var reply = ShowMessage?.Invoke(
                        "File is bigger than 10MB and this tool can have problem to show it. Are you sure?",
                        "Request",
                        MessageBoxButtons.OKCancel,
                        MessageBoxIcon.Exclamation);

                    loadFile = reply == null || reply == DialogResult.OK;
                }

                if (loadFile)
                {
                    try
                    {
                        EnableControls?.Invoke(false);
                        using (var stream = new FileStream(openFileDialog1.FileName, FileMode.Open, FileAccess.Read, FileShare.Read))
                        {
                            using (var sr = new StreamReader(stream, Encoding.UTF8, true))
                            {
                                Text = await sr.ReadToEndAsync();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        ShowMessage?.Invoke(ex.Message);
                    }
                    finally
                    {
                        RefreshUndoRedoButton();
                        EnableControls?.Invoke(true);
                    }
                }
            }
        }
        private async void btnOpenCommentsFile_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog();

            try
            {
                if (fileDialog?.ShowDialog() != true)
                {
                    return;
                }

                txtCommentsFilePath.Text = fileDialog.FileName;
                _spamCommentsList        = await File.ReadAllLinesAsync(fileDialog.FileName)
                                           .ConfigureAwait(true);
            }
            catch (Exception ex)
            {
                await DialogManager.ShowDialog("Some rtarded shit happened", ex.Message)
                .ConfigureAwait(true);
            }
        }
Example #35
0
        private void ChangeFotoAction(object obj)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            if (openFileDialog.ShowDialog() == true)
            {
                var file = openFileDialog.FileName;
                using(var st=new MemoryStream())
                {
                    Stream fs = File.OpenRead(file);
                    using (Image img = Image.FromStream(fs))
                    {
                        int h = 100;
                        int w = 100;
                        using (Bitmap b = new Bitmap(img, new Size(w, h)))
                        {
                            using (var mem2=new MemoryStream())
                            {
                                b.Save(mem2, ImageFormat.Jpeg);
                                SelectedItem.Photo = mem2.ToArray();
                            }
                        }
                    }

                  
                    
                    fs.Close();
                }


              

            }
           // SelectedItem = null;
            MainPegawai.SourceView.Refresh();

        }
        //routines for processing file open, file save and folder browser dialogs
        private DialogResult ShowOpenFileDialog()
        {
            DialogResult res = DialogResult.None;

            _openFileDialog.InitialDirectory = _saveSelectionsFolder;
            _openFileDialog.FileName         = _saveSelectionsFile;
            _openFileDialog.Filter           = _saveFilter;
            _openFileDialog.FilterIndex      = _saveFilterIndex;
            _openFileDialog.Multiselect      = _saveMultiSelect;
            _saveSelectionsFile = string.Empty;
            _saveSelectedFiles  = null;
            res = _openFileDialog.ShowDialog();
            if (res == DialogResult.OK)
            {
                _saveSelectionsFolder = Path.GetDirectoryName(_openFileDialog.FileName);
                _saveSelectionsFile   = _openFileDialog.FileName;
                _saveFilterIndex      = _openFileDialog.FilterIndex;
                if (_openFileDialog.Multiselect)
                {
                    _saveSelectedFiles = _openFileDialog.FileNames;
                }
            }
            return(res);
        }
Example #37
0
        private void buttonRead_Click(object sender, EventArgs e)
        {
            OpenFileDialog theDialog = new OpenFileDialog();

            theDialog.Title  = "Open Text File";
            theDialog.Filter = "TXT files|*.txt";
            if (theDialog.ShowDialog() == DialogResult.OK)
            {
                string filename = theDialog.FileName;

                string[] filelines = File.ReadAllLines(filename);

                listBoxLogs.Items.Clear();
                LogsInit();

                foreach (String elem in filelines)
                {
                    Log = Environment.NewLine + elem;
                    listBoxLogs.Items.Add(Log);
                }

                listBoxLogs.TopIndex = listBoxLogs.Items.Count - 1;
            }
        }
Example #38
0
        private void openSetupFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                using (OpenFileDialog fd = new OpenFileDialog())
                {
                    fd.Title = Resources.select_setup_file;
                    DialogResult dr = fd.ShowDialog();

                    if (dr == DialogResult.OK)
                    {
                        if (!LevelSetupEntry.IsValid(fd.FileName))
                        {
                            throw new Exception(Resources.setup_file_invalid);
                        }

                        Globals.LevelSetups.Clear();
                        Globals.LevelSetups.Add(new LevelSetupEntry(fd.FileName));

                        lstbox_Stages.Items.Clear();

                        foreach (LevelSetupEntry Setup in Globals.LevelSetups)
                        {
                            lstbox_Stages.Items.Add(Setup);
                        }

                        Globals.LoadedStagesJsonHash = Helpers.GetStringSHA1OfString(JsonConvert.SerializeObject(Globals.LevelSetups));
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
        }
Example #39
0
        private void button1_Click(object sender, EventArgs e)
        {
            FileInfo fi = null;

            using (OpenFileDialog ofd = new OpenFileDialog())
            {
                ofd.InitialDirectory = "./";
                ofd.Filter           = fileExtendFilter;
                if (ofd.ShowDialog() == DialogResult.OK)   //如果点击的是打开文件
                {
                    this.textBox1.Text = ofd.SafeFileName; //获取全路径文件名
                    fi = new FileInfo(ofd.FileName);
                }
            }

            if (fi != null && fi.Exists && fi.Extension == ".dxf")
            {
                dxf = DxfDocument.Load(fi.FullName);
                AddLayers();
                AddGraph();

                panel1.Invalidate();
            }
        }
Example #40
0
        public MainWindow()
        {
            InitializeComponent();

            // configure button events
            btn_open.MouseDown += (object s, MouseButtonEventArgs args) => {
                // browse for the file he wants to open
                OpenFileDialog fd = new OpenFileDialog();
                fd.Filter = "Excel Files (*.xlsx) | *.xlsx";
                fd.ShowDialog();
                // check if there's a selected file
                if (File.Exists(fd.FileName))
                {
                    // save a log
                    App.appSettings.Logs.Add(new Log
                    {
                        FullPath = fd.FileName,
                        Time     = DateTime.Now
                    });
                    // refresh recent files
                    Refresh();
                    // run window
                    App.RunWindow(new ManageWindow(fd.FileName));
                }
                else
                {
                    MessageBox.Show("Please, select a valid excel file!", "Loading failed", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            };
            btn_create.MouseDown += (object s, MouseButtonEventArgs args) => {
                App.RunWindow(new ManageWindow());
            };

            // refresh the list of recent opened files
            Refresh();
        }
Example #41
0
        void OpenPoFile()
        {
            using (OpenFileDialog openFileDialog = new OpenFileDialog())
            {
                openFileDialog.Filter           = "po files (*.po)|*.po|All files (*.*)|*.*";
                openFileDialog.FilterIndex      = 1;
                openFileDialog.RestoreDirectory = true;

                if (openFileDialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                // Reload font just in case it changed.
                if (!LoadFont())
                {
                    return;
                }

                string filePath = openFileDialog.FileName;
                ImportPO(filePath);
                cambioImagen(filePath);
            }
        }
Example #42
0
        private void Btn_jiexi_Click(object sender, EventArgs e)
        {
            int            num  = selectedRecord.num;
            string         mima = "";
            OpenFileDialog dlg  = new OpenFileDialog();

            dlg.InitialDirectory = XMLDealTool.getKeyPath();
            dlg.Filter           = "密钥文件|*.png";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                string key = KeyConvert.GetKeyByImage(dlg.FileName);


                string url    = XMLDealTool.getUrlPath() + "cloudkey/getpass.php";
                string data   = "username="******"&password="******"&key=" + key + "&num=" + num;
                string result = HttpGet.HttpGet_test(url, data);
                if (result.IndexOf("error") != -1)
                {
                    MessageBox.Show("解析失败,请检查密钥图片是否正确!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                //MessageBox.Show("您的账号密码是:" + result, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                result = Encrypt.Base64ToString(result);
                mima   = Encrypt.AESDecrypt(result, key);
                if (mima.IndexOf("error") != -1)
                {
                    MessageBox.Show("解析失败,请检查密钥图片是否正确!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else
            {
                return;
            }
            MessageBox.Show("您的账号密码是:" + mima, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        private void button11_Click(object sender, EventArgs e) // gözat butonu
        {
            OpenFileDialog fdlg = new OpenFileDialog();

            fdlg.Title            = "Entropi İçin Excel Dosyası Seçin";
            fdlg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            fdlg.Filter           = "Excel Dosyaları(.xlsx)| *.xlsx| Excel 2003 Dosyaları(.xls)|*.xls";
            fdlg.FilterIndex      = 2;
            fdlg.RestoreDirectory = true;
            if (fdlg.ShowDialog() == DialogResult.OK)
            {
                //MessageBox.Show(fdlg.FileName);
                string          connStr  = "";
                OleDbConnection baglanti = null;
                DataTable       dt       = null;
                if (Path.GetExtension(fdlg.FileName) == ".XLS" || Path.GetExtension(fdlg.FileName) == ".xls")
                {
                    connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fdlg.FileName + ";Extended Properties=\"Excel 8.0;HDR=No;IMEX=1\";";
                }
                else
                {
                    connStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fdlg.FileName + ";Extended Properties='Excel 12.0;HDR=yes'";
                }

                baglanti = new OleDbConnection(@connStr);
                baglanti.Open();
                string           sorgu = "SELECT * FROM [Sayfa1$]";
                OleDbDataAdapter da    = new OleDbDataAdapter(sorgu, baglanti);
                dt = new DataTable();
                da.Fill(dt);
                dataGridView5.DataSource = dt;
                baglanti.Close();

                excelyazdir(dataGridView5);
            }
        }
Example #44
0
        public void LoadDialog()
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.InitialDirectory = Path.Combine(EDDConfig.Options.AppDataDirectory, "Flights");

            if (!Directory.Exists(dlg.InitialDirectory))
            {
                Directory.CreateDirectory(dlg.InitialDirectory);
            }

            dlg.DefaultExt   = "flight";
            dlg.AddExtension = true;

            dlg.Filter = "Flight files (*.flight)|*.flight|All files (*.*)|*.*";

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                if (!ReadFromFile(dlg.FileName))
                {
                    ExtendedControls.MessageBoxTheme.Show("Failed to load flight " + dlg.FileName + ". Check file path and file contents");
                }
            }
        }
        private void btnUpload_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                DataTable table = ofd.FileName.EndsWith("xlsx") ? ImportExcel2007.TranslateToTable(ofd.FileName) : ImportExcel2003.TranslateToTable(ofd.FileName);

                foreach (DataRow row in table.Rows)
                {
                    string model = row.ItemArray[0].ToString().Trim();
                    string code = row.ItemArray[1].ToString().Trim();

                    string query = string.Format("if not exists (select * from tb_model where m_model = '{0}' and m_code = '{1}') insert into tb_model (m_model, m_code) values ('{0}', '{1}')", model, code);
                    DataService.GetInstance().ExecuteNonQuery(query);
                }
                MessageBox.Show("Record has been uploaded.");
            }

            if (cbSearch.SelectedIndex == 0)
                SearchData("");
            else
                SearchData(txtSearch.Text.Trim());
        }
Example #46
0
        /// <summary>
        /// 文件的选择,Controlladdr的显示
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog open_file_dialog = new OpenFileDialog();

            if (open_file_dialog.ShowDialog() == DialogResult.OK)
            {
                this.file_path = open_file_dialog.FileName;
                this.toolStripStatusLabel1.Text = "Current File is:" + this.file_path;
                this.strConn      = @"Provider=Microsoft.Jet.OLEDB.4.0;" + @"Data Source=" + this.file_path;
                this.myConn       = new OleDbConnection(this.strConn);
                this.meta_modules = new Meta_ModuleS(this.myConn);
                this.meta_symbols = new Meta_SymbolS(this.meta_modules);

                string           sqlStr = "SELECT DISTINCT ControllerAddress FROM Prj_Document";
                OleDbDataAdapter da     = new OleDbDataAdapter(sqlStr, myConn);
                DataSet          ds     = new DataSet();
                da.Fill(ds);
                this.dataGridView_ControlAddr.DataSource = ds.Tables[0].DefaultView;
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    controlladdr_list.Add(row[0].ToString());
                }
            }
        }
Example #47
0
        private void BUT_bintolog_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog ofd = new OpenFileDialog())
            {
                ofd.Filter = "Binary Log|*.bin";

                ofd.ShowDialog();

                if (File.Exists(ofd.FileName))
                {
                    using (SaveFileDialog sfd = new SaveFileDialog())
                    {
                        sfd.Filter = "log|*.log";

                        DialogResult res = sfd.ShowDialog();

                        if (res == System.Windows.Forms.DialogResult.OK)
                        {
                            BinaryLog.ConvertBin(ofd.FileName, sfd.FileName);
                        }
                    }
                }
            }
        }
Example #48
0
        private void uploadToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (var ofd = new OpenFileDialog())
            {
                ofd.Title       = "Select files to upload";
                ofd.Filter      = "All files (*.*)|*.*";
                ofd.Multiselect = true;

                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    foreach (var localFilePath in ofd.FileNames)
                    {
                        if (!File.Exists(localFilePath))
                        {
                            continue;
                        }

                        string remotePath = GetAbsolutePath(Path.GetFileName(localFilePath));

                        _fileManagerHandler.BeginUploadFile(localFilePath, remotePath);
                    }
                }
            }
        }
Example #49
0
        private void open_Click(object sender, EventArgs e)
        {
            OpenFileDialog opnDlg = new OpenFileDialog();

            opnDlg.Filter = "所有图像文件 | *.bmp; *.pcx; *.png; *.jpg; *.gif;" +
                            "*.tif; *.ico; *.dxf; *.cgm; *.cdr; *.wmf; *.eps; *.emf|" +
                            "位图( *.bmp; *.jpg; *.png;...) | *.bmp; *.pcx; *.png; *.jpg; *.gif; *.tif; *.ico|" +
                            "矢量图( *.wmf; *.eps; *.emf;...) | *.dxf; *.cgm; *.cdr; *.wmf; *.eps; *.emf";
            opnDlg.Title    = "打开图像文件";
            opnDlg.ShowHelp = true;
            if (opnDlg.ShowDialog() == DialogResult.OK)
            {
                curFileName = opnDlg.FileName;
                try
                {
                    curBitmap = (Bitmap)Image.FromFile(curFileName);
                }
                catch (Exception exp)
                {
                    MessageBox.Show(exp.Message);
                }
            }
            Invalidate();
        }
Example #50
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Stream         myStream        = null;
            OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.InitialDirectory = @"c:\"; openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*) |*.*";

            openFileDialog1.FilterIndex = 2;
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    if ((myStream = openFileDialog1.OpenFile()) != null)
                    {
                        using (myStream)
                        {
                            richTextBox1.LoadFile(openFileDialog1.FileName, RichTextBoxStreamType.PlainText);
                        }
                    } //if
                }     //try
                catch (Exception ex)
                {
                    MessageBox.Show("Error : Could not read file from disk:	" + ex.Message);
                }
            }
        }
Example #51
0
        public override void Run(RenderControl renderer)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Filter = "STEP (*.stp;*.step)|*.stp;*.step";
            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            var shape = StepIO.Open(dialog.FileName);

            if (shape == null)
            {
                return;
            }

            var shapeExplor = new ShapeExplor();

            shapeExplor.AddShape(shape);
            shapeExplor.Build();

            var edgeCount = shapeExplor.GetEdgeCount();

            for (uint ii = 0; ii < edgeCount; ++ii)
            {
                var edge = shapeExplor.GetEdge(ii);
                if (edge.GetCurveType() == EnumCurveType.CurveType_Line)
                {
                    renderer.ShowShape(edge.GetShape(), Vector3.Blue);
                }
                else
                {
                    renderer.ShowShape(edge.GetShape(), Vector3.Red);
                }
            }
        }
Example #52
0
        private void buttonOpen_Click(object sender, EventArgs e)
        {
            OpenFileDialog myOpenFileDialog = new OpenFileDialog()
            {
                InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),

                Title = "Browse Chip8 Roms",

                CheckFileExists = true,
                CheckPathExists = true,

                DefaultExt       = "c8",
                Filter           = "chip8 files (*.c8;*.ch8)|*.c8;*.ch8",
                FilterIndex      = 2,
                RestoreDirectory = true,
            };

            if (myOpenFileDialog.ShowDialog() == DialogResult.OK)
            {
                // Save the filename
                myC8Core.gamePath = myOpenFileDialog.FileName;

                // Load the ROM
                myC8Core.LoadRom();
                // myC8Core.LoadTest();

                // Clear registers
                myC8Core.InitRegs();

                // Clear video memory and refresh screen
                myC8Core.display.Clear();

                // Run the mainloop
                //c8timer.Enabled = true;
            }
        }
        private async void btnEncryptFile_Click(object sender, RoutedEventArgs e)
        {
            if (PersonGuid.Text.Trim() == "")
            {
                showMessageBox("Failed!", "Person Guid must define ");
                return;
            }


            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Multiselect = false;
            if (openFileDialog.ShowDialog() == true)
            {
                String filePath = openFileDialog.FileName;
                await faceLockService.EncryptFile(filePath, Guid.Parse(PersonGuid.Text));
            }
            else
            {
                return;
            }
            showMessageBox("Sucess", "File Encrypted");
            return;
        }
        //-------------------------------------------------------------------------------------------------------------------------------------------------------------------\\

        public static void KayıtAç()
        {
            OpenFileDialog Ac = new OpenFileDialog();

            Ac.Title  = "Dosya Açın";
            Ac.Filter = "Text Dosyaları(*.txt)|*.txt";
            if (Ac.ShowDialog() == DialogResult.OK)
            {
                StreamReader oku = new StreamReader(File.OpenRead(Ac.FileName));
                Sekiller         = new List <Sekil>(); //yeni bir list oluşturuyoruz
                Kullanılan_Sekil = 0;
                while ((Satir = oku.ReadLine()) != null)
                {
                    Sekil      = Satir.Split(',')[0].Substring(6);
                    SekilRenk  = Satir.Split(',')[1].Substring(5);
                    SekilX     = Convert.ToInt32(Satir.Split(',')[2].Substring(2));       //bilgileri split sayesinde ayırıyoruz
                    SekilY     = Convert.ToInt32(Satir.Split(',')[3].Substring(2));
                    SekilXSonu = Convert.ToInt32(Satir.Split(',')[4].Substring(7));
                    SekilYSonu = Convert.ToInt32(Satir.Split(',')[5].Substring(7));
                    KayıtOku();
                }
                oku.Dispose();
            }
        }
Example #55
0
        private void searchPlaylistToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialogSelect = new OpenFileDialog();

            openFileDialogSelect.FileName         = String.Empty;
            openFileDialogSelect.InitialDirectory = @"C:\\";
            openFileDialogSelect.Title            = "Select playlist";
            if (openFileDialogSelect.ShowDialog() == DialogResult.OK && !string.IsNullOrEmpty(openFileDialogSelect.FileName))
            {
                string searchedFile = openFileDialogSelect.FileName;
                axWindowsMediaPlayer.Ctlcontrols.stop();
                files.Clear();
                paths.Clear();
                listBoxSongs.Items.Clear();
                files = File.ReadAllLines(searchedFile).ToList();
                for (int len = 0; len < files.Count; len++)
                {
                    string[] temp = files[len].Split(new string[] { "--" }, StringSplitOptions.RemoveEmptyEntries);
                    listBoxSongs.Items.Add(temp[0]);
                    paths.Add(temp[1]);
                }
                index = 0;
            }
        }
Example #56
0
        private void OnLoad()
        {
            var fileDialog = new OpenFileDialog()
            {
                Filter          = "Supported Files|*.chai;*.wif|Scripts|*.chai|Renderings|*.wif",
                CheckFileExists = true
            };

            var result = fileDialog.ShowDialog();

            if (result == true)
            {
                var path = fileDialog.FileName;

                if (path.ToLower().EndsWith(".wif"))
                {
                    LoadWif(path);
                }
                else
                {
                    LoadScript(path);
                }
            }
        }
Example #57
0
        private void set()
        {
            t1337.Text = Ellipsis.Compact(f1337, t1337, EllipsisFormat.Path);
            toolTip1.SetToolTip(t1337, f1337);
            Properties.Settings.Default["url1337"] = f1337;
            Properties.Settings.Default.Save();
            string[] lines = File.ReadAllLines(f1337);
            if (!check_Symbol(lines[0]))
            {
                return;
            }
            string         unf = lines[0].Substring(1).ToLower().Trim();
            string         nf  = Path.GetFileName(unf);
            string         ext = Path.GetExtension(unf);
            OpenFileDialog apriDialogoFile1 = new OpenFileDialog();

            apriDialogoFile1.FileName    = nf;
            apriDialogoFile1.Filter      = "File " + ext + "|" + nf;
            apriDialogoFile1.FilterIndex = 0;
            apriDialogoFile1.Title       = "Select the file \"" + nf + "\" File...";
            if (apriDialogoFile1.ShowDialog() == DialogResult.OK)
            {
                exe       = apriDialogoFile1.FileName;
                texe.Text = Ellipsis.Compact(Path.GetFileName(exe), texe, EllipsisFormat.Path);
                toolTip1.SetToolTip(texe, exe);
                Properties.Settings.Default["urlexe"] = exe;
                Properties.Settings.Default.Save();
            }
            else
            {
                t1337.Text = "Select .1337 File...";
                texe.Text  = "Name of Exe/Dll to Patch...";
                f1337      = String.Empty;
                exe        = String.Empty;
            }
        }
Example #58
0
        public Object ReadData <type>()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            if (openFileDialog.ShowDialog() != DialogResult.OK)
            {
                return(null);
            }
            string file = openFileDialog.FileName;

            if (file == "")
            {
                return(null);
            }
            Stream stream = File.Open(file, FileMode.Open);

            var binaryFormatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();


            type result = (type)binaryFormatter.Deserialize(stream);

            stream.Dispose();
            return(result);
        }
        /// <summary>
        /// Open image.
        /// </summary>
        private void OpenImage()
        {
            if (_openDialog.ShowDialog() == true)
            {
                _imageFilename = _openDialog.FileName;
                _pageIndex     = -1;
                _bitmapSource  = null;

                try
                {
                    _bitmapSource = LoadImage(_imageFilename, ref _pageIndex);
                }
                catch (Exception ex)
                {
                    readerImage.Source = null;
                    MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                if (_bitmapSource == null)
                {
                    Title = _formTitle;
                    return;
                }

                Title = string.Format(_formTitle + " - {0}", System.IO.Path.GetFileName(_imageFilename));
                if (_pageIndex >= 0)
                {
                    Title += string.Format(" (page {0})", _pageIndex + 1);
                }

                readBarcodesButton.Focus();

                SetReaderImage();
            }
        }
 private void Button11_Click(object sender, EventArgs e)
 {
     if (dateTimePicker11.CustomFormat == " ")
     {
         XtraMessageBox.Show("Tarih Alanı Boş Bırakılamaz");
         return;
     }
     else
     {
         islemsırası = 11;
         OpenFileDialog openFileDialog1 = new OpenFileDialog();
         openFileDialog1.ShowDialog();
         openFileDialog1.Title = "Servis Formu Yükleyiniz";
         if (openFileDialog1.FileName != "")
         {
             servisformu = openFileDialog1.FileName;
             DökümanVeritabanıYükle();
             label11.Text             = "11.Servis Formu Yüklendi✔";
             label11.ForeColor        = Color.Green;
             dateTimePicker12.Enabled = true;
             button12.Enabled         = true;
         }
     }
 }