Beispiel #1
0
        private void btnWizard_Click(object sender, EventArgs e)
        {
            Wizard wiz = new Wizard(project);

            if (wiz.ShowDialog() == DialogResult.OK)
            {
                SettingsManagement.AddFileAsMostRecent(project.FilePath);
                OnlyWelcomeWindow = null;
                this.Close();
            }
        }
Beispiel #2
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            SaveResult res = project.CreateNew();

            if (res == SaveResult.Successful)
            {
                SettingsManagement.AddFileAsMostRecent(project.FilePath);
                this.Close();
            }
            else if (res == SaveResult.Failed)
            {
                MessageBox.Show("Error While Saving Project Configuration");
            }
        }
Beispiel #3
0
 private void listRecentFiles_DoubleClick(object sender, EventArgs e)
 {
     if (listRecentFiles.SelectedIndex >= 0)
     {
         string file = Program.CleanFilePath(SettingsManagement.FilePathFromListBoxIndex(listRecentFiles.SelectedIndex));
         if (project.Open(file))
         {
             SettingsManagement.AddFileAsMostRecent(file);
             this.Close();
         }
         else
         {
             MessageBox.Show("Error, Could Not Load Project");
         }
     }
 }
Beispiel #4
0
        private void btnFind_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(SettingsManagement.FavFolder) == false)
            {
                openFileDialog1.InitialDirectory = SettingsManagement.FavFolder + Path.DirectorySeparatorChar;
            }

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                if (project.Open(openFileDialog1.FileName))
                {
                    SettingsManagement.AddFileAsMostRecent(openFileDialog1.FileName);
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Error, Could Not Load Project");
                }
            }
        }
Beispiel #5
0
        private void btnImportAPS_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "AVR Studio Project (*.aps)|*.aps";

            if (string.IsNullOrEmpty(SettingsManagement.FavFolder) == false)
            {
                ofd.InitialDirectory = SettingsManagement.FavFolder + Path.DirectorySeparatorChar;
            }

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                if (project.ImportAPS(ofd.FileName))
                {
                    MessageBox.Show("Import was Successful" + Environment.NewLine + "Please Save It");
                    SaveResult res = project.Save();
                    if (res == SaveResult.Failed)
                    {
                        MessageBox.Show("Error During Save");
                    }
                    else if (res == SaveResult.Cancelled)
                    {
                        project.IsReady = false;
                    }
                    else
                    {
                        SettingsManagement.AddFileAsMostRecent(project.FilePath);
                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show("Error During Import");
                }
            }
        }
Beispiel #6
0
        public static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            splash = new SplashScreen();
            splash.Show();

            try
            {
                SettingsManagement.Load();
                FileTemplate.Unpack();
                ProjTemplate.Load();

                if (SettingsManagement.AutocompleteEnable)
                {
                    KeywordImageGen.GenerateKeywordImages();
                }
            }
            catch (Exception ex)
            {
                ErrorReportWindow.Show(ex, "Initialization Error");
            }

            try
            {
                UpdateMech.CheckForUpdates();
            }
            catch (Exception ex)
            {
                ErrorReportWindow.Show(ex, "Error Checking Updates");
            }

            try
            {
                AVRProject newProject = new AVRProject();

                if (args.Length > 0)
                {
                    string fname = args[0];

                    if (newProject.Open(fname) == true)
                    {
                        SettingsManagement.AddFileAsMostRecent(fname);
                    }
                    else
                    {
                        MessageBox.Show("Error, failed to open file");
                    }
                }
                else if (SettingsManagement.OpenLastProject)
                {
                    if (string.IsNullOrEmpty(SettingsManagement.LastProjectPath) == false)
                    {
                        if (newProject.Open(SettingsManagement.LastProjectPath) == true)
                        {
                            SettingsManagement.AddFileAsMostRecent(SettingsManagement.LastProjectPath);
                        }
                        else
                        {
                            MessageBox.Show("Error, failed to open file");
                        }
                    }
                }

                KeywordScanner.Initialize();

                Application.Run(new IDEWindow(newProject));

                if (newProject.IsReady)
                {
                    if (SettingsManagement.SaveRecentList() == false)
                    {
                        MessageBox.Show("Error, Could Not Save Recent File List");
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorReportWindow.Show(ex, "Main IDE Error");
            }

            try
            {
                if (UpdateMech.HasFinishedChecking)
                {
                    if (UpdateMech.UpdateAvailable)
                    {
                        try
                        {
                            if (MessageBox.Show("An Updated Version of AVR Project IDE is Available (" + SettingsManagement.Version + " to " + UpdateMech.NewBuildID + "). Would you like to download it?", "Update Available", MessageBoxButtons.YesNo) == DialogResult.Yes)
                            {
                                System.Diagnostics.Process.Start(Properties.Resources.WebsiteURL);
                            }
                        }
                        catch (Exception ex)
                        {
                            ErrorReportWindow.Show(ex, "Updater Error");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorReportWindow.Show(ex, "Error Checking Updates");
            }

            try
            {
                if (SettingsManagement.LastRunVersion != SettingsManagement.Version)
                {
                    NotifyOfUserAction();
                }

                SettingsManagement.LastRunVersion = SettingsManagement.Version;
            }
            catch { }
        }