diff --git a/EuriborSharp/EuriborSharpSettings.Designer.cs b/EuriborSharp/EuriborSharpSettings.Designer.cs index bac73ee..f9ce62b 100644 --- a/EuriborSharp/EuriborSharpSettings.Designer.cs +++ b/EuriborSharp/EuriborSharpSettings.Designer.cs @@ -58,5 +58,29 @@ public bool Xkcd { this["Xkcd"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool DotLineSelected { + get { + return ((bool)(this["DotLineSelected"])); + } + set { + this["DotLineSelected"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool NormalLineSelected { + get { + return ((bool)(this["NormalLineSelected"])); + } + set { + this["NormalLineSelected"] = value; + } + } } } diff --git a/EuriborSharp/EuriborSharpSettings.settings b/EuriborSharp/EuriborSharpSettings.settings index 646c7d8..810b3ef 100644 --- a/EuriborSharp/EuriborSharpSettings.settings +++ b/EuriborSharp/EuriborSharpSettings.settings @@ -11,5 +11,11 @@ True + + False + + + True + \ No newline at end of file diff --git a/EuriborSharp/Interfaces/IGraphControl.cs b/EuriborSharp/Interfaces/IGraphControl.cs index da80b8f..01ef433 100644 --- a/EuriborSharp/Interfaces/IGraphControl.cs +++ b/EuriborSharp/Interfaces/IGraphControl.cs @@ -5,5 +5,7 @@ interface IGraphControl void Init(Enums.TimePeriods period, bool smoothSelected, bool xkcd); void UpdateGraph(); void UpdateSmoothing(bool b); + void SetLineStyleToNormal(); + void SetLineStyleToDot(); } } diff --git a/EuriborSharp/Interfaces/IMainForm.cs b/EuriborSharp/Interfaces/IMainForm.cs index 66df3b2..eb1d87b 100644 --- a/EuriborSharp/Interfaces/IMainForm.cs +++ b/EuriborSharp/Interfaces/IMainForm.cs @@ -18,5 +18,7 @@ interface IMainForm void AddControl(UserControl control, string tabName); void UpdateTitle(string s); void UpdateSmoothSelection(bool selected); + void UpdateLineStyleSelection(bool normalSelected); + void UpdateRendererSelection(bool xkcdSelected); } } diff --git a/EuriborSharp/Model/TheEuribors.cs b/EuriborSharp/Model/TheEuribors.cs index 2a149a1..8adfd92 100644 --- a/EuriborSharp/Model/TheEuribors.cs +++ b/EuriborSharp/Model/TheEuribors.cs @@ -222,8 +222,5 @@ public class Euribors public decimal OneWeek { get; set; } public decimal TwoWeeks { get; set; } public DateTime Date { get; set; } - - public Euribors() - {} } } diff --git a/EuriborSharp/Presenters/MainFormPresenter.cs b/EuriborSharp/Presenters/MainFormPresenter.cs index 472ca04..f14c55a 100644 --- a/EuriborSharp/Presenters/MainFormPresenter.cs +++ b/EuriborSharp/Presenters/MainFormPresenter.cs @@ -17,8 +17,6 @@ namespace EuriborSharp.Presenters { public class MainFormPresenter : IDisposable { - private const string FEED_ADDRESS = @"http://www.suomenpankki.fi/fi/_layouts/BOF/RSS.ashx/tilastot/Korot/fi"; - // Flag: Has Dispose already been called? private bool _disposed; @@ -54,15 +52,15 @@ public MainFormPresenter() _logControl.AddressChanged += _logControl_AddressChanged; _graphControl1Month = new GraphControl(); - _graphControl1Month.Init(TimePeriods.OneMonth, EuriborSharpSettings.Default.SmoothLine, EuriborSharpSettings.Default.Xkcd); _graphControl3Month = new GraphControl(); - _graphControl3Month.Init(TimePeriods.ThreeMonths, EuriborSharpSettings.Default.SmoothLine, EuriborSharpSettings.Default.Xkcd); _graphControl6Month = new GraphControl(); - _graphControl6Month.Init(TimePeriods.SixMonths, EuriborSharpSettings.Default.SmoothLine, EuriborSharpSettings.Default.Xkcd); _graphControl12Month = new GraphControl(); - _graphControl12Month.Init(TimePeriods.TwelveMonths, EuriborSharpSettings.Default.SmoothLine, EuriborSharpSettings.Default.Xkcd); + + InitGraphs(); _mainForm.UpdateSmoothSelection(EuriborSharpSettings.Default.SmoothLine); + _mainForm.UpdateLineStyleSelection(EuriborSharpSettings.Default.NormalLineSelected); + _mainForm.UpdateRendererSelection(EuriborSharpSettings.Default.Xkcd); _mainForm.AddControl((UserControl) _graphControl1Month, TheEuribors.GetInterestName(TimePeriods.OneMonth)); _mainForm.AddControl((UserControl)_graphControl3Month, TheEuribors.GetInterestName(TimePeriods.ThreeMonths)); @@ -72,13 +70,8 @@ public MainFormPresenter() _mainForm.AddControl((UserControl)_logControl, "Log"); #endif - _graphControl1Month.UpdateGraph(); - _graphControl3Month.UpdateGraph(); - _graphControl6Month.UpdateGraph(); - _graphControl12Month.UpdateGraph(); - + UpdateGraphView(); _logControl.UpdateAddress(EuriborSharpSettings.Default.RssFeedAddress); - _feedReader.RunWorkerAsync(); } @@ -86,29 +79,46 @@ void _mainForm_XkcdChanged(object sender, BooleanEventArg e) { EuriborSharpSettings.Default.Xkcd = e.value; EuriborSharpSettings.Default.Save(); + InitGraphs(); UpdateGraphView(); } private void UpdateGraphView() { - _graphControl1Month.Init(TimePeriods.OneMonth, EuriborSharpSettings.Default.SmoothLine, EuriborSharpSettings.Default.Xkcd); _graphControl1Month.UpdateGraph(); - _graphControl3Month.Init(TimePeriods.ThreeMonths, EuriborSharpSettings.Default.SmoothLine, EuriborSharpSettings.Default.Xkcd); _graphControl3Month.UpdateGraph(); - _graphControl6Month.Init(TimePeriods.SixMonths, EuriborSharpSettings.Default.SmoothLine, EuriborSharpSettings.Default.Xkcd); _graphControl6Month.UpdateGraph(); - _graphControl12Month.Init(TimePeriods.TwelveMonths, EuriborSharpSettings.Default.SmoothLine, EuriborSharpSettings.Default.Xkcd); _graphControl12Month.UpdateGraph(); } + private void InitGraphs() + { + _graphControl1Month.Init(TimePeriods.OneMonth, EuriborSharpSettings.Default.SmoothLine, EuriborSharpSettings.Default.Xkcd); + _graphControl3Month.Init(TimePeriods.ThreeMonths, EuriborSharpSettings.Default.SmoothLine, EuriborSharpSettings.Default.Xkcd); + _graphControl6Month.Init(TimePeriods.SixMonths, EuriborSharpSettings.Default.SmoothLine, EuriborSharpSettings.Default.Xkcd); + _graphControl12Month.Init(TimePeriods.TwelveMonths, EuriborSharpSettings.Default.SmoothLine, EuriborSharpSettings.Default.Xkcd); + } + void _mainForm_LineStyleNormalSelected(object sender, EventArgs e) { - throw new NotImplementedException(); + EuriborSharpSettings.Default.NormalLineSelected = true; + EuriborSharpSettings.Default.Save(); + _graphControl1Month.SetLineStyleToNormal(); + _graphControl3Month.SetLineStyleToNormal(); + _graphControl6Month.SetLineStyleToNormal(); + _graphControl12Month.SetLineStyleToNormal(); + UpdateGraphView(); } void _mainForm_LineStyleNoneSelected(object sender, EventArgs e) { - throw new NotImplementedException(); + EuriborSharpSettings.Default.DotLineSelected = true; + EuriborSharpSettings.Default.Save(); + _graphControl1Month.SetLineStyleToDot(); + _graphControl3Month.SetLineStyleToDot(); + _graphControl6Month.SetLineStyleToDot(); + _graphControl12Month.SetLineStyleToDot(); + UpdateGraphView(); } void _mainForm_LineSmoothChanged(object sender, BooleanEventArg e) @@ -132,12 +142,12 @@ void _mainForm_ExitSelected(object sender, EventArgs e) _mainForm.Close(); } - void _mainForm_HelpSelected(object sender, EventArgs e) + static void _mainForm_HelpSelected(object sender, EventArgs e) { throw new NotImplementedException(); } - static void _logControl_AddressChanged(object sender, CustonEventArgs.StringEventArg e) + static void _logControl_AddressChanged(object sender, StringEventArg e) { EuriborSharpSettings.Default.RssFeedAddress = e.value; EuriborSharpSettings.Default.Save(); diff --git a/EuriborSharp/Properties/AssemblyInfo.cs b/EuriborSharp/Properties/AssemblyInfo.cs index 4410883..a373901 100644 --- a/EuriborSharp/Properties/AssemblyInfo.cs +++ b/EuriborSharp/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/EuriborSharp/Views/GraphControl.cs b/EuriborSharp/Views/GraphControl.cs index 84f0c6c..f91b2ae 100644 --- a/EuriborSharp/Views/GraphControl.cs +++ b/EuriborSharp/Views/GraphControl.cs @@ -126,6 +126,18 @@ public void UpdateSmoothing(bool b) _euriborSeries.Smooth = b; } + public void SetLineStyleToNormal() + { + _euriborSeries.LineStyle = LineStyle.Solid; + _graphPlotView.Refresh(); + } + + public void SetLineStyleToDot() + { + _euriborSeries.LineStyle = LineStyle.Dot; + _graphPlotView.Refresh(); + } + private void AddPointsToSeries() { if (_euriborSeries == null) return; diff --git a/EuriborSharp/Views/MainForm.Designer.cs b/EuriborSharp/Views/MainForm.Designer.cs index f76c8f6..8af0eef 100644 --- a/EuriborSharp/Views/MainForm.Designer.cs +++ b/EuriborSharp/Views/MainForm.Designer.cs @@ -34,15 +34,15 @@ private void InitializeComponent() this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.lineTypeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.noneToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.normalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.noneToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.normalLineStyleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.dotLineStyleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.smoothToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.xkcdToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.mainTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); - this.xkcdToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip.SuspendLayout(); this.mainTableLayoutPanel.SuspendLayout(); this.SuspendLayout(); @@ -92,27 +92,27 @@ private void InitializeComponent() // noneToolStripMenuItem // this.noneToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.normalToolStripMenuItem, - this.noneToolStripMenuItem1}); + this.normalLineStyleToolStripMenuItem, + this.dotLineStyleToolStripMenuItem}); this.noneToolStripMenuItem.Name = "noneToolStripMenuItem"; this.noneToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.noneToolStripMenuItem.Text = "Style"; // - // normalToolStripMenuItem + // normalLineStyleToolStripMenuItem // - this.normalToolStripMenuItem.CheckOnClick = true; - this.normalToolStripMenuItem.Name = "normalToolStripMenuItem"; - this.normalToolStripMenuItem.Size = new System.Drawing.Size(114, 22); - this.normalToolStripMenuItem.Text = "Normal"; - this.normalToolStripMenuItem.Click += new System.EventHandler(this.normalToolStripMenuItem_Click); + this.normalLineStyleToolStripMenuItem.CheckOnClick = true; + this.normalLineStyleToolStripMenuItem.Name = "normalLineStyleToolStripMenuItem"; + this.normalLineStyleToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.normalLineStyleToolStripMenuItem.Text = "Normal"; + this.normalLineStyleToolStripMenuItem.Click += new System.EventHandler(this.normalLineStyleToolStripMenuItem_Click); // - // noneToolStripMenuItem1 + // dotLineStyleToolStripMenuItem // - this.noneToolStripMenuItem1.CheckOnClick = true; - this.noneToolStripMenuItem1.Name = "noneToolStripMenuItem1"; - this.noneToolStripMenuItem1.Size = new System.Drawing.Size(114, 22); - this.noneToolStripMenuItem1.Text = "None"; - this.noneToolStripMenuItem1.Click += new System.EventHandler(this.noneToolStripMenuItem1_Click); + this.dotLineStyleToolStripMenuItem.CheckOnClick = true; + this.dotLineStyleToolStripMenuItem.Name = "dotLineStyleToolStripMenuItem"; + this.dotLineStyleToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.dotLineStyleToolStripMenuItem.Text = "Dot"; + this.dotLineStyleToolStripMenuItem.Click += new System.EventHandler(this.dotLineStyleToolStripMenuItem_Click); // // smoothToolStripMenuItem // @@ -122,6 +122,14 @@ private void InitializeComponent() this.smoothToolStripMenuItem.Text = "Smooth"; this.smoothToolStripMenuItem.Click += new System.EventHandler(this.smoothToolStripMenuItem_Click); // + // xkcdToolStripMenuItem + // + this.xkcdToolStripMenuItem.CheckOnClick = true; + this.xkcdToolStripMenuItem.Name = "xkcdToolStripMenuItem"; + this.xkcdToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.xkcdToolStripMenuItem.Text = "Xkcd"; + this.xkcdToolStripMenuItem.Click += new System.EventHandler(this.xkcdToolStripMenuItem_Click); + // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; @@ -164,14 +172,6 @@ private void InitializeComponent() this.mainTableLayoutPanel.Size = new System.Drawing.Size(784, 638); this.mainTableLayoutPanel.TabIndex = 2; // - // xkcdToolStripMenuItem - // - this.xkcdToolStripMenuItem.CheckOnClick = true; - this.xkcdToolStripMenuItem.Name = "xkcdToolStripMenuItem"; - this.xkcdToolStripMenuItem.Size = new System.Drawing.Size(152, 22); - this.xkcdToolStripMenuItem.Text = "Xkcd"; - this.xkcdToolStripMenuItem.Click += new System.EventHandler(this.xkcdToolStripMenuItem_Click); - // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -205,8 +205,8 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripMenuItem smoothToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem noneToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem noneToolStripMenuItem1; - private System.Windows.Forms.ToolStripMenuItem normalToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem dotLineStyleToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem normalLineStyleToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem xkcdToolStripMenuItem; } diff --git a/EuriborSharp/Views/MainForm.cs b/EuriborSharp/Views/MainForm.cs index be82535..f1de8f6 100644 --- a/EuriborSharp/Views/MainForm.cs +++ b/EuriborSharp/Views/MainForm.cs @@ -40,6 +40,17 @@ public void UpdateSmoothSelection(bool selected) smoothToolStripMenuItem.Checked = selected; } + public void UpdateLineStyleSelection(bool normalSelected) + { + normalLineStyleToolStripMenuItem.Checked = normalSelected; + dotLineStyleToolStripMenuItem.Checked = !normalSelected; + } + + public void UpdateRendererSelection(bool xkcdSelected) + { + xkcdToolStripMenuItem.Checked = xkcdSelected; + } + private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { HelpSelected(this, EventArgs.Empty); @@ -50,13 +61,15 @@ private void exitToolStripMenuItem_Click(object sender, EventArgs e) ExitSelected(this, EventArgs.Empty); } - private void noneToolStripMenuItem1_Click(object sender, EventArgs e) + private void dotLineStyleToolStripMenuItem_Click(object sender, EventArgs e) { + normalLineStyleToolStripMenuItem.Checked = false; LineStyleNoneSelected(this, EventArgs.Empty); } - private void normalToolStripMenuItem_Click(object sender, EventArgs e) + private void normalLineStyleToolStripMenuItem_Click(object sender, EventArgs e) { + dotLineStyleToolStripMenuItem.Checked = false; LineStyleNormalSelected(this, EventArgs.Empty); } diff --git a/EuriborSharp/app.config b/EuriborSharp/app.config index d7023c5..489917b 100644 --- a/EuriborSharp/app.config +++ b/EuriborSharp/app.config @@ -16,6 +16,12 @@ True + + False + + + True + \ No newline at end of file