dndm

dndm Mercurial Source Tree


Root/MyDownloader.Extension/SpeedLimit/SpeedLimitUIExtension.cs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.Collections.Generic;
using System.Text;
using MyDownloader.Core.Extensions;
using System.Windows.Forms;
using MyDownloader.Extension.SpeedLimit.UI;
 
namespace MyDownloader.Extension.SpeedLimit
{
    public class SpeedLimitUIExtension: IUIExtension
    {
        #region IUIExtension Members
 
        public Control[] CreateSettingsView()
        {
            return new Control[] { new LimitCfg() };
        }
 
        public void PersistSettings(Control[] settingsView)
        {
            LimitCfg lmt = (LimitCfg)settingsView[0];
 
            Settings.Default.MaxRate = lmt.MaxRate;
            Settings.Default.EnabledLimit = lmt.EnableLimit;
 
            Settings.Default.Save();
        }
 
        #endregion
 
        public void ShowSpeedLimitDialog()
        {
            using (SetSpeedLimitDialog sld = new SetSpeedLimitDialog())
            {
                if (sld.ShowDialog() == DialogResult.OK)
                {
                    PersistSettings(new Control[] { sld.limitCfg1 });
                }
            }
        }
    }
}
Source at commit 1dae03ea3242 created 11 years 10 months ago.
By Nathan Adams, Initial commit

Archive Download this file

Branches

Tags

Page rendered in 0.81633s using 11 queries.