Example #1
0
        private void editSettings_Click(object sender, EventArgs e) {
            if (logHistory.SelectedIndex < 0)
                return;

            var cur_history = history_[logHistory.SelectedIndex];
            var old_syntax = cur_history.settings.get("syntax");
            var edit = new edit_log_settings_form(cur_history.settings.ToString());
            if (edit.ShowDialog(this) == DialogResult.OK) {
                bool friendly_name_changed = cur_history.friendly_name != edit.friendly_name;
                // at this point, we've updated all settings
                text_.merge_setings(new settings_as_string(edit.settings));
                cur_context().merge_settings( factory.get_context_dependent_settings(text_, text_.settings), edit.edited_syntax_now);

                Text = reader_title() + " - Log Wizard " + version();

                if (friendly_name_changed) 
                    update_history();

                bool will_restart = false;
                if ( edit.needs_restart)
                    if (MessageBox.Show("Changes will take effect only after restart.\r\nWould you like to restart LogWizard now?", "LogWizard", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        will_restart = true;

                var new_settings = cur_history.settings; 
                var new_syntax = new_settings.get("syntax");
                if ( new_settings.get("type") == "file")
                    if (old_syntax != new_syntax && !will_restart) {
                        // in this case, the user has changed the syntax - need to reload everything
                        save();

                        // force complete refresh
                        text_.Dispose();
                        text_ = null;
                        remove_all_log_views();
                        load();
                        on_file_drop(selected_file_name());
                        // we want to refresh it only after it's been loaded, so that it visually shows that
                        util.postpone(() => full_log_ctrl_.force_refresh_visible_columns( all_log_views() ), 2000);
                    }
                save();

                if ( will_restart)
                    restart_app();
            }
        }
Example #2
0
        private void do_open_log(string initial_settings_str, string config_file) {
            var add = new edit_log_settings_form(initial_settings_str, edit_log_settings_form.edit_type.add);
            if (config_file != "")
                add.load_config(config_file);
            if (add.ShowDialog(this) == DialogResult.OK) {
                log_settings_string settings = new log_settings_string(add.settings);
                if (is_log_in_history(ref settings)) {
                    // we already have this in history
                    create_text_reader(settings);
                    return;
                }
                
                var new_ = new history();
                new_.from_settings(settings);
                history_list_.add_history(new_);
                global_ui.last_log_guid = new_.guid;

                Text = reader_title();
                create_text_reader(new_.write_settings);
                save();
            }            
        }
Example #3
0
        private void whatsupOpen_Click(object sender, EventArgs e) {
            var add = new edit_log_settings_form("", edit_log_settings_form.edit_type.add);
            if (add.ShowDialog(this) == DialogResult.OK) {
                settings_as_string_readonly settings = new settings_as_string(add.settings);
                if (is_log_in_history(ref settings)) {
                    // we already have this in history
                    create_text_reader(settings);
                    return;
                }
                var new_ = new history();
                new_.from_settings(settings);

                history_.Add(new_);
                ++ignore_change_;
                logHistory.Items.Add(history_.Last().ui_friendly_name);
                logHistory.SelectedIndex = logHistory.Items.Count - 1;
                --ignore_change_;

                Text = reader_title() + " - Log Wizard " + version();
                create_text_reader(new_.settings);
                save();
            }
        }
Example #4
0
        private void whatsupOpen_Click(object sender, EventArgs e) {
            var add = new edit_log_settings_form("", edit_log_settings_form.edit_type.add);
            if (add.ShowDialog(this) == DialogResult.OK) {
                log_settings_string settings = new log_settings_string(add.settings);
                if (is_log_in_history(ref settings)) {
                    // we already have this in history
                    create_text_reader(settings);
                    return;
                }
                
                var new_ = new history();
                new_.from_settings(settings);
                history_list_.add_history(new_);
                global_ui.last_log_guid = new_.guid;

                // should not be needed
#if old_code
                recreate_history_combo();
                ++ignore_change_;
                logHistory.SelectedIndex = logHistory.Items.Count - 1;
                --ignore_change_;
#endif

                Text = reader_title();
                create_text_reader(new_.write_settings);
                save();
            }
        }