Пример #1
0
 private void OpenButton_Click(object sender, EventArgs e)
 {
     if (MainOpenFileDialog.ShowDialog() == DialogResult.OK)
     {
         LoadConfiguration(MainOpenFileDialog.FileName);
     }
 }
Пример #2
0
 private void toolStripMenuItemOpenCustomLogo_Click(object sender, EventArgs e)
 {
     #region OpenLogoFileAdmin
     if (CheckAdmin.IsUserAdministrator() == true)
     {
         if (radioButton4mib.Checked == false && radioButton6MIB.Checked == false && radioButton8MIB.Checked == false && radioButton16MIB.Checked == false && radioButton32MIB.Checked == false)
         {
             MessageBox.Show(res_man.GetString("MainForm_SelectLogoSizeWarn", cul), "Moto_Boot_Logo_Maker", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         else
         {
             MainOpenFileDialog.Filter           = @"BIN file|*.bin|ZIP file|*.zip";
             MainOpenFileDialog.InitialDirectory = userdesktoppath;
             if (MainOpenFileDialog.ShowDialog() != DialogResult.OK)
             {
                 return;
             }
             OpenFile(MainOpenFileDialog.FileName);
             Properties.Settings.Default.LogoBinOpen = MainOpenFileDialog.FileName.ToString();
             Properties.Settings.Default.Save();
             toolStripStatusLabel3.Text = @"\ " + res_man.GetString("MainForm_CurrentProjectText", cul) + Properties.Settings.Default.LogoBinOpen;
             EnableControlsWhenLoadLogo();
         }
     }
     else
     {
         MessageBox.Show(res_man.GetString("MainForm_OpenCustomLogoNoAdminTool", cul), "Moto_Boot_Logo_Maker", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     #endregion OpenLogoFileAdmin
 }
Пример #3
0
        private void PlaceInfo_UploadNewDataFileButton_Click(object sender, EventArgs e)
        {
            try {
                MainOpenFileDialog.Title           = "Выбор файла с данными";
                MainOpenFileDialog.FileName        = "";
                MainOpenFileDialog.Filter          = "Текстовый файл|*.txt|Все файлы|*.*";
                MainOpenFileDialog.CheckFileExists = true;
                MainOpenFileDialog.CheckPathExists = true;
                if (MainOpenFileDialog.ShowDialog() == DialogResult.OK)
                {
                    string[]  data = PlaceInfoHelper.UploadTextFile(MainOpenFileDialog.FileName);
                    Control[] ctrls = new Control[] { PlaceInfo_NewData1Box, PlaceInfo_NewData2Box, PlaceInfo_NewData3Box, PlaceInfo_NewData4Box, PlaceInfo_NewData5Box }.Select(c => { c.Text = ""; return(c); }).ToArray();
                    for (int i = 0; i < data.Length; i++)
                    {
                        if (i >= ctrls.Length)
                        {
                            break;
                        }

                        ctrls[i].Text = data[i];
                    }
                }
            }
            catch (Exception ex) {
                AppHelper.CreateMessage(ex.ToString(), Feodosiya.Lib.Logs.MessageType.Error, true);
            }
        }
Пример #4
0
 public void LoadFile()
 {
     if (MainOpenFileDialog.ShowDialog() != DialogResult.Cancel)
     {
         if (MultipleFilesChbx.Checked)
         {
             FileSelectiontxt.Text = MainOpenFileDialog.FileName;
             SaveasTxt.Text        = MainOpenFileDialog.FileName;
             //MultipleFileList.Items.Add(FileSelectiontxt.Text);
         }
         else
         {
             ROM = File.ReadAllBytes(MainOpenFileDialog.FileName);
             FileSelectiontxt.Text       = MainOpenFileDialog.FileName;
             SaveasTxt.Text              = MainOpenFileDialog.FileName;
             MainSaveFileDialog.FileName = Path.GetDirectoryName(SaveasTxt.Text);
             string exc = Path.GetExtension(MainOpenFileDialog.FileName);
             SaveasTxt.Text            = SaveasTxt.Text.Replace(Path.GetFileName(MainOpenFileDialog.FileName), "CorruptedFile" + exc);
             MaxByte                   = ROM.Length - 1;
             StartByteTrackBar.Maximum = MaxByte;
             EndByteTrackbar.Maximum   = MaxByte;
             EndByteTrackbar.Value     = MaxByte;
             EndByteNumb.Maximum       = MaxByte;
             EndByteNumb.Value         = MaxByte;
             StartByteNumb.Maximum     = MaxByte;
             backupROM                 = ROM;
         }
     }
 }
Пример #5
0
 private void PlaceInfo_DBBrowseButton_Click(object sender, EventArgs e)
 {
     MainOpenFileDialog.Title           = "Выбор базы данных";
     MainOpenFileDialog.FileName        = "POSTITEM.IB";
     MainOpenFileDialog.Filter          = "БД InterBase 7.0|*.ib|БД Firebird|*.fdb|БД InterBase|*.gdb|Все файлы|*.*";
     MainOpenFileDialog.CheckFileExists = false;
     MainOpenFileDialog.CheckPathExists = false;
     if (MainOpenFileDialog.ShowDialog() == DialogResult.OK)
     {
         PlaceInfo_DBPathBox.Text = MainOpenFileDialog.FileName;
     }
 }
Пример #6
0
 private void openToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (MainOpenFileDialog.ShowDialog() == DialogResult.OK)
         {
             SavingAndLoading.LoadNetwork(MainSaveFileDialog.FileName, out network);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #7
0
        private void DoStuff()
        {
            if (MainOpenFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                using (var reader = new System.IO.StreamReader(MainOpenFileDialog.FileName))
                {
                    List <int> lines = new List <int>();
                    while (!reader.EndOfStream)
                    {
                        lines.Add(int.Parse(reader.ReadLine()));
                    }

                    reader.Close();
                }
            }
        }
Пример #8
0
        private void tvLogo_DoubleClick(object sender, EventArgs e)
        {
            if (tvLogo.SelectedNode == null)
            {
                return;
            }
            MainOpenFileDialog.Filter           = @"Png file|*.png|Jpg file|*.jpg|Jpeg file|*.jpeg|Bitmap file|*.bmp|Gif file|*.gif|Icon file|*.ico|All files|*.*";
            MainOpenFileDialog.InitialDirectory = userdesktoppath;
            if (MainOpenFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            if (CheckAllIMG(5621440) == true)
            {
                return;
            }
            var img = new Bitmap(new MemoryStream(File.ReadAllBytes(MainOpenFileDialog.FileName)));

            AddToBitmapList(img, Path.GetFileName(MainOpenFileDialog.FileName), tvLogo.SelectedNode.Text);
            toolStripStatusLabel1.Text = MainOpenFileDialog.FileName;
            tvLogo_AfterSelect(sender, null);
        }
Пример #9
0
        private void buttonAppend_Click(object sender, EventArgs e)
        {
            #region AppendImageToLogo
            if ((cboMoto.SelectedIndex > 0) && buttonAppend.Text == res_man.GetString("MainForm_BTN_Append", cul))
            {
                return;
            }
            if (txtLogoInternalFile.Text == "")
            {
                return;
            }
            if (buttonAppend.Text == res_man.GetString("MainForm_BTN_Append", cul))
            {
                switch (txtLogoInternalFile.Text)
                {
                case "logo_boot":
                    init_tree(LOGO.LOGO_BOOT);
                    break;

                case "logo_battery":
                    init_tree(LOGO.LOGO_BATTERY);
                    break;

                case "logo_unlocked":
                    init_tree(LOGO.LOGO_UNLOCKED);
                    break;

                case "logo_lowpower":
                    init_tree(LOGO.LOGO_LOWPOWER);
                    break;

                case "logo_unplug":
                    init_tree(LOGO.LOGO_UNPLUG);
                    break;

                case "logo_charge":
                    init_tree(LOGO.LOGO_CHARGE);
                    break;

                case "logo_yellow":
                    init_tree(LOGO.LOGO_YELLOW);
                    break;

                case "logo_red":
                    init_tree(LOGO.LOGO_RED);
                    break;

                case "logo_orange":
                    init_tree(LOGO.LOGO_ORANGE);
                    break;
                }
            }
            MainOpenFileDialog.Filter           = @"Png file|*.png|Jpg file|*.jpg|Jpeg file|*.jpeg|Bitmap file|*.bmp|Gif file|*.gif|Icon file|*.ico|All files|*.*";
            MainOpenFileDialog.InitialDirectory = userdesktoppath;
            if (MainOpenFileDialog.ShowDialog() == DialogResult.OK)
            {
                if (CheckAllIMG(5621440) == true)
                {
                    return;
                }
                var img = new Bitmap(new MemoryStream(File.ReadAllBytes(MainOpenFileDialog.FileName)));
                AddToBitmapList(img, Path.GetFileName(MainOpenFileDialog.FileName), txtLogoInternalFile.Text);
                toolStripStatusLabel1.Text = MainOpenFileDialog.FileName;
            }
            else
            {
                var nodeFound = false;
                foreach (var node in tvLogo.Nodes.Cast <TreeNode>().Where(node => node.Text == txtLogoInternalFile.Text))
                {
                    node.Name = "";
                    nodeFound = true;
                }
                if (!nodeFound)
                {
                    tvLogo.Nodes.Add(txtLogoInternalFile.Text);
                }
            }
            buttonAppend.Text = res_man.GetString("MainForm_BTN_Replace", cul);
            #endregion AppendImageToLogo
        }