Ejemplo n.º 1
0
 protected override void OnClosing(CancelEventArgs e)
 {
     this.trafficStats.Save();
     this.trafficStats.OnDataChanged  -= TrafficdStats_OnDataChanged;
     this.trafficStats.OnSpeedChanged -= TrafficStats_OnSpeedChanged;
     if (this.tsSuspentionForm != null)
     {
         this.tsSuspentionForm.ParentForm = null;
         this.tsSuspentionForm            = null;
     }
     base.OnClosing(e);
 }
Ejemplo n.º 2
0
 private void CreateSuspentionForm()
 {
     if (this.trafficStatsSuspentionForm == null)
     {
         this.trafficStatsSuspentionForm             = new TrafficStatsSuspensionForm(this.controller, this.trafficStats);
         this.trafficStatsSuspentionForm.FormClosed += TrafficStatsSuspentionForm_FormClosed;
         this.trafficStatsForm                      = new TrafficStatsForm(this.trafficStatsSuspentionForm, this.trafficStats);
         this.trafficStatsForm.FormClosed          += TrafficStatsForm_FormClosed;
         this.trafficStatsSuspentionForm.ParentForm = trafficStatsForm;
         this.trafficStatsSuspentionForm.Show();
     }
 }
Ejemplo n.º 3
0
 private void DestorySuspentionForm()
 {
     if (this.trafficStatsSuspentionForm != null)
     {
         this.trafficStatsSuspentionForm.Close();
     }
     if (this.trafficStatsForm != null)
     {
         this.trafficStatsForm.Close();
     }
     this.trafficStatsForm           = null;
     this.trafficStatsSuspentionForm = null;
     System.GC.Collect();
 }
Ejemplo n.º 4
0
        public TrafficStatsForm(TrafficStatsSuspensionForm pSub, TrafficStats stats)
        {
            this.tsSuspentionForm = pSub;

            InitializeComponent();

            Icon              = Icon.FromHandle(Resources.ssw128.GetHicon());
            this.SizeChanged += new EventHandler(this.TrafficStatsForm_SizeChanged);

            this.trafficStats = stats;
            this.trafficStats.OnDataChanged  += TrafficdStats_OnDataChanged;
            this.trafficStats.OnSpeedChanged += TrafficStats_OnSpeedChanged;

            StatsItem totalItem = Utils.ConvertToMiB(this.trafficStats.MonthTotal);

            this.textbox_total.Text = totalItem.Value.ToString();
            this.label_total.Text   = totalItem.Unit;
            StatsItem statsItem = Utils.ConvertToMiB(this.trafficStats.MonthUsed);

            this.textbox_used.Text = statsItem.Value.ToString();
            this.label_used.Text   = statsItem.Unit;

            this.UpdateTexts();
        }
Ejemplo n.º 5
0
 private void TrafficStatsSuspentionForm_FormClosed(object sender, FormClosedEventArgs e)
 {
     trafficStatsSuspentionForm.Dispose();
     trafficStatsSuspentionForm = null;
     Utils.ReleaseMemory(true);
 }