コード例 #1
0
        public CommandsEditor(string fp)
        {
            InitializeComponent();
            CPriority.Items.AddRange(Enum.GetValues(typeof(CommandPriority)).Cast <CommandPriority>().ToList().ConvertAll(k => k.ToString()).ToArray());
            CPriority.SelectedIndex = 0;

            if (FilePath == "")
            {
                OpenFile.Filter = "Rocket Commands|" + Rocket.Core.Environment.CommandsFile;
                if (OpenFile.ShowDialog() == DialogResult.OK)
                {
                    _mem = new CommandsMemory(OpenFile.FileName);
                    Text = "Editing: " + OpenFile.FileName;
                    _mem._rc.CommandMappings.ForEach(k => Commands.Items.Add(k.Name));
                    Commands.SelectedIndex = Commands.Items.Count > 0 ? 0 : -1;
                    RefreshCommandData();
                    return;
                }
                else
                {
                    Load += (s, e) => Close();
                    return;
                }
            }
            _mem = new CommandsMemory(FilePath);
            Text = "Editing: " + FilePath;
            _mem._rc.CommandMappings.ForEach(k => Commands.Items.Add(k.Name));
            Commands.SelectedIndex = Commands.Items.Count > 0 ? 0 : -1;
            RefreshCommandData();
        }
コード例 #2
0
ファイル: FormClient.cs プロジェクト: trefilovboris/LongWork
 private void Choose1_Click(object sender, EventArgs e)
 {
     if (OpenFile.ShowDialog() == DialogResult.OK)
     {
         Argument1.Text = OpenFile.FileName;
     }
 }
コード例 #3
0
 private void BtnAddPhoto_Click(object sender, EventArgs e)
 {
     if (OpenFile.ShowDialog() == DialogResult.OK)
     {
         phonoPictureBox.Load(OpenFile.FileName);
     }
 }
コード例 #4
0
        private void Load_Click(object sender, EventArgs e)
        {
            if (OpenFile.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            Toolbox.Enabled = true;
            string filename = OpenFile.FileName;

            WorkPanel.Visible = true;
            controller.SaveCurrentProject(WorkPanel, countControls);
            countControls++;
            currentProject = countControls;
            TreeView.Nodes[0].Nodes.Add("Loaded Project " + countControls);
            TreeView.ExpandAll();
            InterfaceDesigner.ActiveForm.Text = "Interface Designer - " + "Loaded Project " + countControls;
            controller.Load(filename, WorkPanel, ListOfFigures);
            if (countControls == 5)
            {
                Create.Enabled      = false;
                Load.Enabled        = false;
                CreateBtn.Enabled   = false;
                DownloadBtn.Enabled = false;
            }
        }
コード例 #5
0
ファイル: Form1.cs プロジェクト: AdrianBennettDev/LogParser
 private void OpenFileButton_Click(object sender, EventArgs e)
 {
     if (OpenFile.ShowDialog() == DialogResult.OK)
     {
         TextOutputBox.Text = null;
     }
 }
コード例 #6
0
ファイル: Interface.cs プロジェクト: sabihoshi/cs
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var buffer   = "";
            var fileName = "";
            var htmlName = "";

            if (OpenFile.ShowDialog() == DialogResult.OK)
            {
                var sr = new
                         StreamReader(OpenFile.FileName);
                fileName = OpenFile.SafeFileName;
                buffer   = sr.ReadToEnd();
                sr.Close();
            }

            fileName = string.Format(@"..\..\Data\Users\{0}_{1}", Entry.userName, fileName);
            htmlName = @"file:///" + Path.GetFullPath(fileName);
            using (StreamWriter file = File.CreateText(fileName))
            {
                file.Write("<body background = \"{0}\">", Path.GetFullPath(@"..\..\Resources\background.png"));
                file.Write(Markdown.ToHtml(buffer));
                file.Write(@"</body>");
                file.Close();
            }

            User.userData.Recent = @"..\..\Data\Users" + fileName;
            User.JsonUpdate(User.userFile, User.userData);
            WebBrowser.Url = new Uri(htmlName);
        }
コード例 #7
0
ファイル: MainFrame.cs プロジェクト: snailium/SaveEditors
        private void LoadButton_Click(object sender, EventArgs e)
        {
            DialogResult result = OpenFile.ShowDialog();

            // OK button was pressed.
            if (result == DialogResult.OK)
            {
                SaveFileName = OpenFile.FileName;
                try
                {
                    // Output the requested file in richTextBox1.
                    SaveFile = new FileStream(SaveFileName, FileMode.Open, FileAccess.ReadWrite);
                    LoadSaveFile();
                }
                catch (Exception exp)
                {
                    MessageBox.Show("An error occurred while attempting to load the file. The error is:"
                                    + System.Environment.NewLine + exp.ToString() + System.Environment.NewLine);
                }
            }

            // Cancel button was pressed.
            else if (result == DialogResult.Cancel)
            {
                return;
            }
        }
コード例 #8
0
 private void PicKonum_Click(object sender, EventArgs e)
 {
     OpenFile.ShowDialog();
     Pic.ImageLocation = OpenFile.FileName.ToString();
     txtPic.Text       = OpenFile.FileName.ToString();
     txtPic.Text       = txtPic.Text.Replace("\\", "/");
 }
コード例 #9
0
ファイル: MainForm.cs プロジェクト: drewdz/FieldDataTest
 private void FileOpenMenu_Click(object sender, EventArgs e)
 {
     try
     {
         if (OpenFile.ShowDialog(this) != DialogResult.OK)
         {
             return;
         }
         //  deserialize
         if (new FileInfo(OpenFile.FileName).Extension.EndsWith("csv", StringComparison.InvariantCultureIgnoreCase))
         {
             var data = Program.ImportData(OpenFile.FileName)?.ToList();
             var min  = data.Min(d => d.Timestamp);
             data.ForEach(d => d.Timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds() + (d.Timestamp - min) + 10000);
             _Data = data;
         }
         else
         {
             using (var fs = new FileStream(OpenFile.FileName, FileMode.Open, FileAccess.Read))
             {
                 using (var sr = new StreamReader(fs))
                 {
                     var data = Serializer.Deserialize <List <ZebraData> >(sr.ReadToEnd())?.Select(z => (EventData)z).ToList();
                     var min  = data.Min(d => d.Timestamp);
                     data.ForEach(d => d.Timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds() + (d.Timestamp - min) + 10000);
                     _Data = data;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.Message);
     }
 }
コード例 #10
0
        private void btnCari_Click(object sender, EventArgs e)
        {
            try {
                if (OpenFile.ShowDialog() == DialogResult.OK)
                {
                    Cursor.Current = Cursors.WaitCursor;

                    string    pathName    = OpenFile.FileName;
                    string    fileName    = Path.GetFileNameWithoutExtension(OpenFile.FileName);
                    DataTable tbContainer = new DataTable();
                    string    strConn     = string.Empty;
                    string    sheetName   = "data";

                    FileInfo file = new FileInfo(pathName);
                    if (!file.Exists)
                    {
                        throw new Exception("Error, file doesn't exists!");
                    }
                    string extension = file.Extension;
                    strConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + pathName + ";Extended Properties='Excel 12.0;HDR=Yes;IMEX=1;'";
                    OleDbConnection  cnnxls = new OleDbConnection(strConn);
                    OleDbDataAdapter oda    = new OleDbDataAdapter(string.Format("select * from [{0}$]", sheetName), cnnxls);
                    oda.Fill(tbContainer);

                    dgLog.DataSource = tbContainer;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #11
0
 private void AddRef_Click(object sender, EventArgs e)
 {
     if (OpenFile.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         AddAssembly(OpenFile.FileName);
     }
 }
コード例 #12
0
ファイル: Form1.cs プロジェクト: omerhijazi404/TextEdit
 private void Open_Click(object sender, EventArgs e)
 {
     if (OpenFile.ShowDialog() == DialogResult.OK)
     {
         textBox1.Text = OpenFile.FileName;
     }
 }
コード例 #13
0
ファイル: MainForm.cs プロジェクト: mbsky/bugx
 /// <summary>
 /// Handles the Click event of the LoadBugFile control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 void LoadBugFile_Click(object sender, EventArgs e)
 {
     if (OpenFile.ShowDialog() == DialogResult.OK)
     {
         LoadBug(OpenFile.FileName);
     }
 }
コード例 #14
0
 private void Open_Click(object sender, EventArgs e)
 {
     if (OpenFile.ShowDialog() == DialogResult.Cancel)
     {
         return;
     }
 }
コード例 #15
0
ファイル: Form1.cs プロジェクト: MehaSyav1k/SuperPaint
 private void openToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (OpenFile.ShowDialog() == DialogResult.OK)
     {
         Picture.Load(OpenFile.FileName);
     }
 }
コード例 #16
0
ファイル: Form1.cs プロジェクト: ethanliew/Crypto-Notepad
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            saveConfirm(false);
            if (cancelPressed == true)
            {
                cancelPressed = false;
                return;
            }

            if (OpenFile.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            {
                if (!OpenFile.FileName.Contains(".cnp"))
                {
                    string opnfile        = File.ReadAllText(OpenFile.FileName);
                    string NameWithotPath = Path.GetFileName(OpenFile.FileName);
                    customRTB.Text = opnfile;
                    this.Text      = appName + NameWithotPath;
                    string cc2 = customRTB.Text.Length.ToString(CultureInfo.InvariantCulture);
                    customRTB.Select(Convert.ToInt32(cc2), 0);
                    return;
                }
                DecryptAES();
                if (publicVar.okPressed == true)
                {
                    publicVar.okPressed = false;
                    currentFilename     = Path.GetFileName(OpenFile.FileName);
                }
            }
        }
コード例 #17
0
        private void btnOpen_Click(object sender, EventArgs e)
        {
            OpenFile.Filter = "Text and Compressed Files (*.lzw,*.txt)|*.txt;*.lzw|Text Files (*.txt)|*.txt|Compressed Files (*.lzw)|*.lzw";
            if (OpenFile.ShowDialog() == DialogResult.OK)
            {
                Clear();
                if (OpenFile.FileName.EndsWith(".lzw") == true)
                {
                    txtOriginal.WordWrap   = true;
                    txtCompressed.WordWrap = false;
                    btnCompress.Text       = "Decompress";
                    lblOriginal.Text       = "Compressed";
                    lblCompressed.Text     = "Original";
                }
                else
                {
                    txtOriginal.WordWrap   = false;
                    txtCompressed.WordWrap = true;
                    btnCompress.Text       = "Compress";
                    lblOriginal.Text       = "Original";
                    lblCompressed.Text     = "Compressed";
                }

                Read();
                InitializeDictionary();

                txtPath.Text        = OpenFile.FileName;
                btnCompress.Enabled = true;
            }
        }
コード例 #18
0
ファイル: Form1.cs プロジェクト: atul2210/imageloader
        private void btnBrowse_Click(object sender, EventArgs e)
        {
            int size = -1;


            OpenFile.InitialDirectory = "d:\\";
            OpenFile.Filter           = "Image Files(*.BMP; *.JPG; *.GIF)| *.BMP; *.JPG; *.GIF | All files(*.*) | *.* "; //"txt files (*.txt)|*.txt|All files (*.*)|*.*";
            DialogResult result = OpenFile.ShowDialog();

            if (result == DialogResult.OK)
            {
                try
                {
                    string filename = null;
                    txtFile.Text = OpenFile.FileName;
                    // First load the image somehow
                    Image myImage = Image.FromFile(txtFile.Text.Trim(), true);
                    // Save the image with a quality of 50%

                    ///  string path = AppDomain.CurrentDomain.BaseDirectory;
                    ///
                    string path = ConfigurationManager.AppSettings["SaveImagePath"].ToString();
                    /// string datetimesecond = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss");
                    //// datetimesecond = datetimesecond.Replace("/", "").Replace(":", "");
                    string fileDirectory = DateTime.Now.ToString("MMMM dd") + DateTime.Now.Year.ToString();
                    createDirectory = path + "\\" + fileDirectory;

                    var index = txtFile.Text.LastIndexOf(@"\");

                    if (index != -1)
                    {
                        filename = txtFile.Text.Substring((index + 1), (txtFile.Text.Trim().Length - 1) - index);
                    }


                    if (Directory.Exists(path))
                    {
                        Directory.CreateDirectory(createDirectory);
                        SaveJpeg(createDirectory + "\\" + filename, myImage, 50);
                        createDirectory = ConfigurationManager.AppSettings["SaveImageforUI"].ToString() + fileDirectory + "\\" + filename;   // createDirectory + "\\temp.jpg";
                    }
                    else
                    {
                        SaveJpeg(createDirectory + "\\" + filename, myImage, 50);
                        createDirectory = ConfigurationManager.AppSettings["SaveImageforUI"].ToString() + fileDirectory + "\\" + filename;
                    }



                    /////  data = ReadAllBytes(createDirectory + "\\" + txtFile.Text);


                    ////StoreImage(data, txtFile.Text.Trim());
                }
                catch (IOException)
                {
                }
            }
        }
コード例 #19
0
 private void openScriptToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (OpenFile.ShowDialog() == DialogResult.OK)
     {
         OpenLFile(OpenFile.FileName);
         Status.Text = "Opened file `" + CurrentFile + "` successfully.";
     }
 }
コード例 #20
0
 /// <summary>
 /// Choose ViewerPath
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnChooseViewerPath_Click(object sender, EventArgs e)
 {
     OpenFile.InitialDirectory = Application.StartupPath;
     if (OpenFile.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         txtViewerPath.Text = OpenFile.FileName;
     }
 }
コード例 #21
0
 private void Button_Choose_Click(object sender, EventArgs e)
 {
     if (DialogResult.OK == OpenFile.ShowDialog())
     {
         MyFiles.Clear();
         MyFiles.AddRange(OpenFile.FileNames);
     }
 }
コード例 #22
0
ファイル: MainForm.cs プロジェクト: ChrisAkridge/FileToBitmap
 private void ButtonOpenFile_Click(object sender, EventArgs e)
 {
     if (OpenFile.ShowDialog() == DialogResult.OK)
     {
         this.loadedFilePath = OpenFile.FileName;
         this.DrawImage();
     }
 }
コード例 #23
0
 private void SelectImageButton_Click(object sender, EventArgs e)
 {
     DialogResult = DialogResult.Abort;
     if (OpenFile.ShowDialog() == DialogResult.OK)
     {
         PosterImageTB.Text = OpenFile.FileName;
     }
 }
コード例 #24
0
 private void butOpen_Click(object sender, EventArgs e)
 {
     OpenFile.Title      = "Select Adventure to edit.";
     OpenFile.FileName   = "";
     OpenFile.DefaultExt = "*.tab";
     OpenFile.Filter     = "Adventure Files | *.tab";
     OpenFile.ShowDialog();
 }
コード例 #25
0
 /// <summary>
 /// Import Queue
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The e.
 /// </param>
 private void MnuImportClick(object sender, EventArgs e)
 {
     OpenFile.FileName = string.Empty;
     OpenFile.ShowDialog();
     if (OpenFile.FileName != String.Empty)
     {
         queue.QueueManager.RestoreQueue(OpenFile.FileName);
     }
 }
コード例 #26
0
ファイル: Form1.cs プロジェクト: Eugene851001/OOPLabs
 private void btChangeFile_Click(object sender, EventArgs e)
 {
     if (OpenFile.ShowDialog() == DialogResult.OK)
     {
         string fileName = OpenFile.FileName;
         astroService.ChangeFileName(fileName);
         tbFilePath.Text = astroService.FileName;
     }
 }
コード例 #27
0
ファイル: Form_1.cs プロジェクト: AntonSushilov/Tasks
 private void OpenStrip_Click(object sender, EventArgs e)
 {
     if (OpenFile.ShowDialog() == DialogResult.OK)
     {
         Text             = new TextFile();
         SourceText.Lines = Text.ReadFile(OpenFile.FileName);
         Path             = OpenFile.FileName;
     }
 }
コード例 #28
0
 private void BtnAnexar_Click(object sender, EventArgs e)
 {
     if (OpenFile.ShowDialog() == DialogResult.OK)
     {
         for (int i = 0; i < OpenFile.FileNames.Length; i++)
         {
             ListAnexos.Items.Add(OpenFile.FileNames[i]);
         }
     }
 }
コード例 #29
0
 private void Button_Add_Click(object sender, EventArgs e)
 {
     if (DialogResult.OK == OpenFile.ShowDialog())
     {
         foreach (string file in OpenFile.FileNames)
         {
             Text_InputFiles.Text += file + "\r\n";
         }
     }
 }
コード例 #30
0
ファイル: ChartForm.cs プロジェクト: zurgeg/riivolution
        private void Browse(TextBox textbox, string title, string filter)
        {
            OpenFile.Title  = title;
            OpenFile.Filter = filter;
            if (OpenFile.ShowDialog(this) == DialogResult.Cancel)
            {
                return;
            }

            textbox.Text = OpenFile.FileName;
        }