Example #1
0
 //
 // Zapisuje informacje o aktualizacji
 //
 private static void SaveUpdateSettings(string settingName, bool value)
 {
     using (SettingsManagement sm = new SettingsManagement())
     {
         sm.SaveFirstStart(settingName, value);
     }
 }
        public void Connect()
        {
            try
            {
                if (dropPorts.SelectedIndex >= 0)
                {
                    serialPort1.PortName = (string)dropPorts.Items[dropPorts.SelectedIndex];
                }
                else
                {
                    serialPort1.PortName = lastUsedPort;
                }

                serialPort1.BaudRate = int.Parse((string)dropBaud.Items[dropBaud.SelectedIndex]);
                serialPort1.Open();
                barRxStatus.Maximum = serialPort1.ReadBufferSize;
                btnConnect.Text     = "Disonnect";
                btnSend.Enabled     = true;
                dropPorts.Enabled   = false;
                dropBaud.Enabled    = false;
                attemptedDisconnect = false;

                SettingsManagement.SaveSerialPortPrefs(serialPort1.PortName, serialPort1.BaudRate);
            }
            catch (Exception ex)
            {
                RaiseException(ex);
            }
        }
Example #3
0
 public SheetPublisher(ILogger <SheetPublisher> logger, SettingsManagement settingsMgmt, IDataAccessRegistry dataAccessRegistry, ThermostatManagement thermostatMgmt)
 {
     _logger             = logger;
     _settingsMgmt       = settingsMgmt;
     _dataAccessRegistry = dataAccessRegistry;
     _thermostatMgmt     = thermostatMgmt;
 }
        private void btnSaveAndClose_Click(object sender, EventArgs e)
        {
            SettingsManagement.AutocompleteEnable = chkAutocomplete.Checked;
            SettingsManagement.SettingsFile.Write("Editor", "AutocompleteEnable", chkAutocomplete.Checked.ToString().ToLowerInvariant().Trim());
            SettingsManagement.SettingsFile.Write("Editor", "IndentWidth", numIndentWidth.Value.ToString("0"));
            SettingsManagement.SettingsFile.Write("Editor", "IndentTabWidth", numTabWidth.Value.ToString("0"));
            SettingsManagement.SettingsFile.Write("Editor", "IndentUseTab", chkUseTabs.Checked.ToString().Trim().ToLowerInvariant());
            SettingsManagement.SettingsFile.Write("Editor", "IndentBackspaceUnindents", chkBackspaceUnindents.Checked.ToString().Trim().ToLowerInvariant());
            SettingsManagement.SettingsFile.Write("Editor", "IndentTabIndents", chkTabIndents.Checked.ToString().Trim().ToLowerInvariant());
            SettingsManagement.SettingsFile.Write("Editor", "IndentGuide", chkIndentGuide.Checked.ToString().Trim().ToLowerInvariant());
            SettingsManagement.SettingsFile.Write("Editor", "IndentSmartness", dropSmartIndent.SelectedIndex.ToString("0"));
            SettingsManagement.SettingsFile.Write("Editor", "LineWrap", chkWordWrap.Checked.ToString().Trim().ToLowerInvariant());
            SettingsManagement.SettingsFile.Write("Editor", "ShowLineNumbers", chkShowLineNum.Checked.ToString().Trim().ToLowerInvariant());
            SettingsManagement.SettingsFile.Write("Editor", "ShowWhiteSpace", chkShowWS.Checked.ToString().Trim().ToLowerInvariant());
            //SettingsManagement.SettingsFile.Write("Editor", "TrimOnSave", chkTrimSpaceOnSave.Checked.ToString().Trim().ToLowerInvariant());
            SettingsManagement.SettingsFile.Write("Editor", "BackupInterval", numBackupInterval.Value.ToString("0"));
            SettingsManagement.SettingsFile.Write("Editor", "BuildMessageBehaviour", radMsgOnTop.Checked ? "NewMsgOnTop" : "NewMsgOnBottom");
            SettingsManagement.SettingsFile.Write("Editor", "OpenLastProject", chkReopenProject.Checked.ToString().Trim().ToLowerInvariant());
            SettingsManagement.SettingsFile.Write("Editor", "HighlightCurrentLine", chkHighlightCurLine.Checked.ToString().Trim().ToLowerInvariant());

            SettingsManagement.CheckForUpdates = chkCheckUpdates.Checked;
            SettingsManagement.LoadScintSettings();

            ProjectBuilder.ReverseOutput = radMsgOnBottom.Checked;

            this.Close();
        }
Example #5
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();
            }
        }
Example #6
0
        //
        // Sprawdza czy program był aktualizowany - odczytuje z ustawień
        //
        private static bool CheckUpdateSettings(string settingName)
        {
            bool update = true;

            using (SettingsManagement sm = new SettingsManagement())
            {
                // Sprawdz aktualizację 1.1.0.2
                update = sm.LoadFirstStart(settingName);
            }
            return(update);
        }
        private void init()
        {
            // password box in main toolstrip
            var passwordTextBox = this.passwordTextBox.Control as TextBox;

            passwordTextBox.PasswordChar = '*';

            // set credentials, if available
            this.toolStripTextBoxServer.Text     = SettingsManagement.GetHostName();
            this.toolStripTextBoxCertificat.Text = SettingsManagement.GetClientCertificate();
        }
Example #8
0
        public EditorPanel(ProjectFile file, AVRProject project, IDEWindow parent)
        {
            InitializeComponent();

            this.parent  = parent;
            this.file    = file;
            this.project = project;

            SettingsManagement.LoadEditorState(this);

            this.Icon = GraphicsResx.file;
        }
Example #9
0
        private void frmWelcome_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (project.IsReady)
            {
                if (SettingsManagement.SaveRecentList() == false)
                {
                    MessageBox.Show("Error, Could Not Save Recent File List");
                }
            }

            SettingsManagement.WelcomeWindowAtStart = chkShowWelcomeAtStart.Checked;
            OnlyWelcomeWindow = null;
        }
Example #10
0
        //
        // Sprawdza czy program jest uruchamiany po raz pierwszy
        //
        private bool CheckFirstStart()
        {
            bool firstStart = true;

            using (SettingsManagement sm = new SettingsManagement())
            {
                firstStart = sm.LoadFirstStart(FIRST_STATRT_SETTINGS);

                // Jeśli uruchomiono po raz pierwszy to zapisz to w ustawieniach
                //if (firstStart) sm.SaveFirstStart(FIRST_STATRT_SETTINGS, !firstStart);
            }

            return(firstStart);
        }
Example #11
0
        public WelcomeWindow(AVRProject project)
        {
            InitializeComponent();

            SettingsManagement.FillListBox(listRecentFiles);

            this.project = project;

            this.Icon = GraphicsResx.mainicon;

            chkShowWelcomeAtStart.Checked = SettingsManagement.WelcomeWindowAtStart;

            backgroundWorker1.RunWorkerAsync();
        }
Example #12
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");
            }
        }
Example #13
0
        //
        // Odczytuje indeks/typ sortowania zapisany w ustawieniach
        // 1.0.0.4
        private void LoadSortIndex()
        {
            /*
             * CEL:
             * Odczytuje indeks/typ sortowania zapisany w ustawieniach
             *	0 - sortowanie wg. cytatu
             *	1 - sortowanie wg. autora
             *	2 - tylko ulubione cytaty
             */

            // Odczytaj ustawienia
            using (SettingsManagement sm = new SettingsManagement())
            {
                SortIndex = sm.LoadSortIndex(SORT_INDEX_SETTINGS);
            }
        }
Example #14
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");
         }
     }
 }
        public async void connect()
        {
            SettingsManagement.PersistConnectionData(
                this.toolStripTextBoxServer.Text,
                this.toolStripTextBoxCertificat.Text);

            var uri =
                new Uri(
                    string.Format(
                        "https://{0}:{1}/",
                        SettingsManagement.GetHostName(),
                        SettingsManagement.GetServicePort()));

            formatting = new FormattingServiceWrapper();

            try
            {
                // path to service certificate (located in program folder)
                var serverCertPath = @"C:\CERTIFICAT\Format.Service_server.cer";

                var svcConfig =
                    new FormattingServiceConfig(
                        uri,
                        serverCertPath,
                        SettingsManagement.GetClientCertificate());
                formatting.Initialize(svcConfig);

                // get version, for testing
                this.SwitchWaiting(true);
                string version = await formatting.GetVersionAsync();

                this.SwitchOnline(true, version);
                recupFormats();
            }
            catch (Exception ex)
            {
                this.HandleFailure(ex);
            }
            finally
            {
                this.SwitchWaiting(false);
            }
        }
        public DisassemblyViewer()
        {
            InitializeComponent();

            string oldOpts = SettingsManagement.LastDisassemblyOptions;

            if (string.IsNullOrEmpty(oldOpts) == false)
            {
                txtOptions.Text = oldOpts;
            }
            else
            {
                txtOptions.Text = "-h -D -S";
            }

            SettingsManagement.SetScintSettings(scintilla1, false, true);

            mbtnInvisible.Visible = false;
        }
Example #17
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");
                }
            }
        }
Example #18
0
        private void EditorPanelContent_FormClosing(object sender, FormClosingEventArgs e)
        {
            SettingsManagement.SaveEditorState(this);
            if (HasChanged && closeWithoutSave == false)
            {
                DialogResult res = MessageBox.Show("You Have Not Saved " + FileName + Environment.NewLine + "Would you like to save it?", "Closing Unsaved File", MessageBoxButtons.YesNoCancel);
                if (res == DialogResult.Yes)
                {
                    if (Save() != SaveResult.Successful)
                    {
                        e.Cancel = true;
                    }
                }
                else if (res == DialogResult.Cancel)
                {
                    e.Cancel = true;
                }

                if (e.Cancel == false)
                {
                    file.IsOpen = false;
                }
            }
            else if (HasChanged == false)
            {
                SaveBookmarks();
                SaveFolding();
                File.CursorPos = scint.CurrentPos;
            }

            if (e.Cancel == false)
            {
                WatchingForChange = false;
                File.DeleteBackup();

                file.Node.ImageKey         = "file2.ico";
                file.Node.SelectedImageKey = "file2.ico";
                file.Node.StateImageKey    = "file2.ico";
                this.file.IsOpen           = false;
            }
        }
Example #19
0
        public SettingsModule(SettingsManagement settingsMgmt) : base("/api/_settings")
        {
            _settingsMgmt = settingsMgmt;
            Get("/", (p) =>
            {
                var settings = _settingsMgmt.GetSettings();
                return(Negotiate.WithModel(new SettingsRequest
                {
                    PollingInterval = settings.PollingInterval,
                    PollingSensorsPath = settings.PollingSensorsPath,
                    PollingTemperatureFile = settings.PollingTemperatureFile,
                    SensorInsideId = settings.SensorInsideId,
                    SensorOutsideId = settings.SensorOutsideId,
                    TargetTemperature = settings.TargetTemperature,
                    PinCool = settings.PinCool,
                    PinHeat = settings.PinHeat,
                    Diff = settings.Diff
                }));
            });

            Put("/", (p) =>
            {
                var req                         = this.Bind <SettingsRequest>();
                var settings                    = _settingsMgmt.GetSettings();
                settings.PollingInterval        = req.PollingInterval == default(int) ? settings.PollingInterval : req.PollingInterval;
                settings.PollingSensorsPath     = req.PollingSensorsPath ?? settings.PollingSensorsPath;
                settings.PollingTemperatureFile = req.PollingTemperatureFile ?? settings.PollingTemperatureFile;
                settings.SensorInsideId         = req.SensorInsideId ?? settings.SensorInsideId;
                settings.SensorOutsideId        = req.SensorOutsideId ?? settings.SensorOutsideId;
                settings.TargetTemperature      = req.TargetTemperature == default(float) ? settings.TargetTemperature : req.TargetTemperature;
                settings.PinCool                = req.PinCool == default(int) ? settings.PinCool : req.PinCool;
                settings.PinHeat                = req.PinHeat == default(int) ? settings.PinHeat : req.PinHeat;
                settings.Diff                   = req.Diff == default(float) ? settings.Diff : req.Diff;
                settingsMgmt.UpdateSettings(settings);
                return(Negotiate.WithStatusCode(HttpStatusCode.OK));
            });
        }
Example #20
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");
                }
            }
        }
Example #21
0
        private void EditorPanelContent_Shown(object sender, EventArgs e)
        {
            if (LoadFile() == false)
            {
                MessageBox.Show("File '" + this.FileName + "' failed to open");
                this.Close();
                return;
            }

            if (file.FileExt == "c" || file.FileExt == "cpp" || file.FileExt == "h" || file.FileExt == "hpp" || file.FileExt == "pde")
            {
                scint = SettingsManagement.SetScintSettings(scint, false, false);
                scint = KeywordImageGen.ApplyImageList(scint);
            }
            else if (file.FileExt == "s" || file.FileExt == "asm")
            {
                //scint.Lexing.Lexer = Lexer.Asm;
                //scint = SettingsManagement.SetScintSettings(scint, true, false);
                scint = SettingsManagement.SetScintSettings(scint, true, true);
            }
            else if (file.FileName.ToLowerInvariant() == "makefile")
            {
                scint.Lexing.Lexer = Lexer.MakeFile;
                scint = SettingsManagement.SetScintSettings(scint, true, true);
            }
            else
            {
                scint.Lexing.Lexer = Lexer.Null;
                scint = SettingsManagement.SetScintSettings(scint, true, true);
            }

            fileSystemWatcher1.Filter              = file.FileName;
            fileSystemWatcher1.Path                = file.FileDir + Path.DirectorySeparatorChar;
            fileSystemWatcher1.NotifyFilter        = NotifyFilters.FileName | NotifyFilters.LastWrite;
            fileSystemWatcher1.EnableRaisingEvents = true;
        }
Example #22
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 { }
        }
Example #23
0
 public Reading(ILogger <Reading> logger, IDataAccessRegistry dataAccessRegistry, SettingsManagement settingsMgmt)
 {
     _logger             = logger;
     _dataAccessRegistry = dataAccessRegistry;
     _settingsMgmt       = settingsMgmt;
 }