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); }
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(); } }
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(); }
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(); }
private void TrafficStatsSuspentionForm_FormClosed(object sender, FormClosedEventArgs e) { trafficStatsSuspentionForm.Dispose(); trafficStatsSuspentionForm = null; Utils.ReleaseMemory(true); }