Inheritance: System.Configuration.SettingsProvider, IApplicationSettingsProvider
Beispiel #1
0
 private void Save(bool forceDialog)
 {
     SaveFormSettings();
     if (forceDialog || string.IsNullOrEmpty(FileName))
     {
         SaveFileDialog dlg = new SaveFileDialog
         {
             Filter   = DialogFilter,
             FileName = DefaultFileName
         };
         DialogResult result = dlg.ShowDialog();
         if (result == DialogResult.OK)
         {
             FeedBuilderSettingsProvider p = new FeedBuilderSettingsProvider();
             p.SaveAs(dlg.FileName);
             FileName = dlg.FileName;
         }
     }
     else
     {
         FeedBuilderSettingsProvider p = new FeedBuilderSettingsProvider();
         p.SaveAs(FileName);
     }
     UpdateTitle();
 }
Beispiel #2
0
		private void frmMain_Load(Object sender, EventArgs e)
		{
			Visible = false;
            InitializeFormSettings();
			string[] args = Environment.GetCommandLineArgs();
			// The first arg is the path to ourself
			//If args.Count >= 2 Then
			//    If File.Exists(args(1)) Then
			//        Dim p As New FeedBuilderSettingsProvider()
			//        p.LoadFrom(args(1))
			//        Me.FileName = args(1)
			//    End If
			//End If

			// The first arg is the path to ourself
			_argParser = new ArgumentsParser(args);
			if (!_argParser.HasArgs) return;
			FileName = _argParser.FileName;
			if (!string.IsNullOrEmpty(FileName)) {
				if (File.Exists(FileName)) {
					FeedBuilderSettingsProvider p = new FeedBuilderSettingsProvider();
					p.LoadFrom(FileName);
				} else {
					_argParser.ShowGui = true;
					_argParser.Build = false;
					FileName = _argParser.FileName;
					UpdateTitle();
				}
			}
			if (_argParser.ShowGui) Show();
			if (_argParser.Build) Build();
			if (!_argParser.ShowGui) Close();
		}
Beispiel #3
0
        private void btnOpen_Click(Object sender, EventArgs e)
        {
            OpenFileDialog dlg;

            if (_openDialog == null)
            {
                dlg = new OpenFileDialog
                {
                    CheckFileExists = true,
                    FileName        = string.IsNullOrEmpty(FileName) ? DefaultFileName : FileName
                };
                _openDialog = dlg;
            }
            else
            {
                dlg = _openDialog;
            }
            dlg.Filter = DialogFilter;
            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            FeedBuilderSettingsProvider p = new FeedBuilderSettingsProvider();

            p.LoadFrom(dlg.FileName);
            FileName = dlg.FileName;
            InitializeFormSettings();
        }
Beispiel #4
0
        private void btnOpen_Click(System.Object sender, System.EventArgs e)
        {
            OpenFileDialog dlg = null;

            if (this._openDialog == null)
            {
                dlg = new OpenFileDialog();
                dlg.CheckFileExists = true;
                if (string.IsNullOrEmpty(this.FileName))
                {
                    dlg.FileName = DefaultFileName;
                }
                else
                {
                    dlg.FileName = this.FileName;
                }
                this._openDialog = dlg;
            }
            else
            {
                dlg = this._openDialog;
            }
            dlg.Filter = DialogFilter;
            DialogResult result = dlg.ShowDialog();

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                FeedBuilderSettingsProvider p = new FeedBuilderSettingsProvider();
                p.LoadFrom(dlg.FileName);
                InitializeFormSettings();
                this.FileName = dlg.FileName;
            }
        }
Beispiel #5
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            Visible = false;
            InitializeFormSettings();
            var args = Environment.GetCommandLineArgs();

            // The first arg is the path to ourself
            //If args.Count >= 2 Then
            //    If File.Exists(args(1)) Then
            //        Dim p As New FeedBuilderSettingsProvider()
            //        p.LoadFrom(args(1))
            //        Me.FileName = args(1)
            //    End If
            //End If

            // The first arg is the path to ourself
            _argParser = new ArgumentsParser(args);

            if (!_argParser.HasArgs)
            {
                FreeConsole();
                return;
            }

            FileName = _argParser.FileName;
            if (!string.IsNullOrEmpty(FileName))
            {
                if (File.Exists(FileName))
                {
                    var p = new FeedBuilderSettingsProvider();
                    p.LoadFrom(FileName);
                    InitializeFormSettings();
                }
                else
                {
                    _argParser.ShowGui = true;
                    _argParser.Build   = false;
                    UpdateTitle();
                }
            }
            if (_argParser.ShowGui)
            {
                Show();
            }
            if (_argParser.Build)
            {
                Build();
            }
            if (!_argParser.ShowGui)
            {
                Close();
            }
        }
Beispiel #6
0
 private void btnOpen_Click(Object sender, EventArgs e)
 {
     OpenFileDialog dlg;
     if (_openDialog == null) {
         dlg = new OpenFileDialog {
             CheckFileExists = true,
             FileName = string.IsNullOrEmpty(FileName) ? DefaultFileName : FileName
         };
         _openDialog = dlg;
     } else dlg = _openDialog;
     dlg.Filter = DialogFilter;
     if (dlg.ShowDialog() != DialogResult.OK) return;
     FeedBuilderSettingsProvider p = new FeedBuilderSettingsProvider();
     p.LoadFrom(dlg.FileName);
     FileName = dlg.FileName;
     InitializeFormSettings();
 }
Beispiel #7
0
 private void frmMain_DragDrop(object sender, DragEventArgs e)
 {
     string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
     if (files.Length == 0)
     {
         return;
     }
     try {
         string fileName = files[0];
         FeedBuilderSettingsProvider p = new FeedBuilderSettingsProvider();
         p.LoadFrom(fileName);
         FileName = fileName;
         InitializeFormSettings();
     } catch (Exception ex) {
         MessageBox.Show("The file could not be opened: \n" + ex.Message);
     }
 }
Beispiel #8
0
 private void btnOpen_Click(System.Object sender, System.EventArgs e)
 {
     OpenFileDialog dlg = null;
     if (this._openDialog == null) {
         dlg = new OpenFileDialog();
         dlg.CheckFileExists = true;
         if (string.IsNullOrEmpty(this.FileName)) {
             dlg.FileName = DefaultFileName;
         } else {
             dlg.FileName = this.FileName;
         }
         this._openDialog = dlg;
     } else {
         dlg = this._openDialog;
     }
     dlg.Filter = DialogFilter;
     DialogResult result = dlg.ShowDialog();
     if (result == System.Windows.Forms.DialogResult.OK) {
         FeedBuilderSettingsProvider p = new FeedBuilderSettingsProvider();
         p.LoadFrom(dlg.FileName);
         InitializeFormSettings();
         this.FileName = dlg.FileName;
     }
 }
Beispiel #9
0
 private void Save(bool forceDialog)
 {
     SaveFormSettings();
     if (forceDialog || string.IsNullOrEmpty(FileName)) {
         SaveFileDialog dlg = new SaveFileDialog {
             Filter = DialogFilter,
             FileName = DefaultFileName
         };
         DialogResult result = dlg.ShowDialog();
         if (result == DialogResult.OK) {
             FeedBuilderSettingsProvider p = new FeedBuilderSettingsProvider();
             p.SaveAs(dlg.FileName);
             FileName = dlg.FileName;
         }
     } else {
         FeedBuilderSettingsProvider p = new FeedBuilderSettingsProvider();
         p.SaveAs(FileName);
     }
     UpdateTitle();
 }
Beispiel #10
0
 private void frmMain_DragDrop(object sender, DragEventArgs e)
 {
     string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
     if (files.Length == 0) return;
     try {
         string fileName = files[0];
         FeedBuilderSettingsProvider p = new FeedBuilderSettingsProvider();
         p.LoadFrom(fileName);
         FileName = fileName;
         InitializeFormSettings();
     } catch (Exception ex) {
         MessageBox.Show("The file could not be opened: \n" + ex.Message);
     }
 }