This question is locked. New answers and comments are not allowed.
Hi when I adding new RadPane to my RadPaneGroup memory usage is increasing its normal but when i close it Im using
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
But my memory usage is same.
And I open same pane with same content memory increasing again.
Here Is Content
Here Is Content Base
How can I solve this problem ?
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
But my memory usage is same.
And I open same pane with same content memory increasing again.
RadPane pane = new RadPane { Header = "Header", Tag = "btnCalisma" }; pane.Content = new WorkTimeReport(null); pane.Unloaded += new RoutedEventHandler(pane_Unloaded); this.PergoDock.HaritaGrubu.Items.Add(pane);void pane_Unloaded(object sender, RoutedEventArgs e) { (sender as RadPane).Unloaded -= pane_Unloaded; (sender as RadPane).RemoveFromParent(); GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); }Here Is Content
<local:PergoUserControl x:Class="Pergo.Reports.Views.ctrl.WorkTimeReport" xmlns:local="clr-namespace:Pergo.Components.Components;assembly=Pergo.Components" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" mc:Ignorable="d" d:DesignHeight="600" d:DesignWidth="800" > <Grid x:Name="LayoutRoot" Background="White" > <Grid.RowDefinitions> <RowDefinition Height="32" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <Grid Grid.Row="0"> <Grid.RowDefinitions> <RowDefinition Height="5" /> <RowDefinition Height="*" /> <RowDefinition Height="5" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="20" /> <ColumnDefinition Width="30" /> <ColumnDefinition Width="2" /> <ColumnDefinition Width="120" /> <ColumnDefinition Width="20" /> <ColumnDefinition Width="25" /> <ColumnDefinition Width="2" /> <ColumnDefinition Width="120" /> <ColumnDefinition Width="20" /> <ColumnDefinition Width="50" x:Name="colCompaniesExp" /> <ColumnDefinition Width="2" /> <ColumnDefinition x:Name="colCompanies" Width="180" /> <ColumnDefinition Width="20" /> <ColumnDefinition Width="80" /> <ColumnDefinition Width="*" /> <ColumnDefinition Width="130" /> <ColumnDefinition Width="10" /> </Grid.ColumnDefinitions> <TextBlock Grid.Row="1" Grid.Column="1" Text="Yıl : " telerik:StyleManager.Theme="Windows7" VerticalAlignment="Center" HorizontalAlignment="Right" /> <telerik:RadComboBox Grid.Column="3" Grid.Row="1" Name="cbxYear" telerik:StyleManager.Theme="Windows7" /> <TextBlock Grid.Row="1" Grid.Column="5" Text="Ay :" telerik:StyleManager.Theme="Windows7" VerticalAlignment="Center" HorizontalAlignment="Right" /> <telerik:RadComboBox Grid.Column="7" Grid.Row="1" Name="cbxMonth" telerik:StyleManager.Theme="Windows7"> <telerik:RadComboBoxItem Content="Ocak" /> <telerik:RadComboBoxItem Content="Şubat" /> <telerik:RadComboBoxItem Content="Mart" /> <telerik:RadComboBoxItem Content="Nisan" /> <telerik:RadComboBoxItem Content="Mayıs" /> <telerik:RadComboBoxItem Content="Haziran" /> <telerik:RadComboBoxItem Content="Temmuz" /> <telerik:RadComboBoxItem Content="Ağustos" /> <telerik:RadComboBoxItem Content="Eylül" /> <telerik:RadComboBoxItem Content="Ekim" /> <telerik:RadComboBoxItem Content="Kasım" /> <telerik:RadComboBoxItem Content="Aralık" /> </telerik:RadComboBox> <TextBlock Text="Grup : " Grid.Column="9" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Right" Name="lblGroupIdentifier"/> <telerik:RadComboBox Grid.Column="11" Grid.Row="1" Name="cbxCompanies" SelectedIndex="0" telerik:StyleManager.Theme="Windows7"> <telerik:RadComboBox.ItemTemplate> <DataTemplate> <CheckBox Content="{Binding Path=Text}" IsChecked="{Binding Path=IsSelected,Mode=TwoWay}" Height="16" HorizontalAlignment="Left" Margin="2" VerticalAlignment="Top" /> </DataTemplate> </telerik:RadComboBox.ItemTemplate> <telerik:RadComboBox.SelectionBoxTemplate > <DataTemplate> <TextBlock Text="{Binding ElementName=cmbCompanies, Path=ItemsSource.SelectedItemsText}" /> </DataTemplate> </telerik:RadComboBox.SelectionBoxTemplate> </telerik:RadComboBox> <telerik:RadButton Grid.Column="13" Grid.Row="1" Content="Filtrele" Name="btnFilter" Click="RadButton_Click" telerik:StyleManager.Theme="Windows7" /> </Grid> <Grid Grid.Row="1" > <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <telerik:RadGridView Grid.Column="0" Name="grdMonths" IsFilteringAllowed="False" AutoGenerateColumns="False" RowIndicatorVisibility="Collapsed" IsReadOnly="True" ShowGroupPanel="False" > <telerik:RadGridView.Columns> <telerik:GridViewDataColumn Header="Ay" Width="*" TextAlignment="Left" DataMemberBinding="{Binding Date}" /> <telerik:GridViewDataColumn Header="Çalışma Süresi" HeaderTextAlignment="Right" Width="*" DataMemberBinding="{Binding WorkTime}" TextAlignment="Right" /> </telerik:RadGridView.Columns> </telerik:RadGridView> <telerik:RadGridView Grid.Column="1" Name="grdDays" ShowGroupPanel="False" IsFilteringAllowed="False" AutoGenerateColumns="False" RowIndicatorVisibility="Collapsed" IsReadOnly="True" > <telerik:RadGridView.Columns> <telerik:GridViewDataColumn Header="Gün" Width="*" TextAlignment="Left" DataMemberBinding="{Binding Date}" /> <telerik:GridViewDataColumn Header="Çalışma Süresi" HeaderTextAlignment="Right" Width="*" DataMemberBinding="{Binding WorkTime}" TextAlignment="Right" /> </telerik:RadGridView.Columns> </telerik:RadGridView> </Grid> </Grid></local:PergoUserControl>using System;using System.Collections.ObjectModel;using Pergo.Components;using Pergo.Components.Components.cClass;using Pergo.Components.PergoWCF;namespace Pergo.Reports.Views.ctrl{ public partial class WorkTimeReport : Pergo.Components.Components.PergoUserControl { string TerminalID; bool IsMain = false; ~WorkTimeReport() { //Dispose(); } public override void Dispose() { try { this.Client.GetWorkingTimeReportCompleted -= client_GetWorkingTimeReportCompleted; this.btnFilter.Click -= RadButton_Click; this.grdDays.ItemsSource = null; this.grdMonths.ItemsSource = null; this.Client.GetWorkingTimeReportCompleted -= client_GetWorkingTimeReportCompleted; this.btnFilter.Click -= RadButton_Click; this.LayoutRoot.Children.Clear(); } catch { } base.Dispose(); GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); } public WorkTimeReport(string terminalID) { this.InitializeComponent(); this.TerminalID = terminalID; this.Client = new WCFClient(); this.Client.GetWorkingTimeReportCompleted += new EventHandler<GetWorkingTimeReportCompletedEventArgs>( client_GetWorkingTimeReportCompleted); for (int i = 2005; i <= DateTime.Now.Year; i++) { this.cbxYear.Items.Add(i); } if (string.IsNullOrEmpty(this.TerminalID)) { if (Utils.LoggedInUser.AuthenticatedCompanyList != null) { this.SetComboBox(true); } else { this.SetComboBox(false); this.lblGroupIdentifier.Text = "Araç : "; } } else { this.lblGroupIdentifier.Visibility = System.Windows.Visibility.Collapsed; this.cbxCompanies.Visibility = System.Windows.Visibility.Collapsed; this.colCompanies.Width = new System.Windows.GridLength(1); this.colCompaniesExp.Width = new System.Windows.GridLength(1); } this.cbxMonth.SelectedIndex = DateTime.Now.Month - 1; this.cbxYear.SelectedValue = DateTime.Now.Year; this.IsMain = true; this.GetData(0); } private void GetData(int Month) { if (string.IsNullOrEmpty(this.TerminalID)) { if (Utils.LoggedInUser.AuthenticatedCompanyList != null) { this.Client.GetWorkingTimeReportAsync(Month, Convert.ToInt32(this.cbxYear.SelectedValue), this.GetComboValuesInt(), null); } else { this.Client.GetWorkingTimeReportAsync(Month, Convert.ToInt32(this.cbxYear.SelectedValue), null, this.GetComboValuesStr()); } } else { this.Client.GetWorkingTimeReportAsync(Month, Convert.ToInt32(this.cbxYear.SelectedValue), null, new ObservableCollection<string>() { this.TerminalID }); } } private ObservableCollection<string> GetComboValuesStr() { ObservableCollection<string> list = new ObservableCollection<string>(); foreach (CheckboxDataItem item in this.cbxCompanies.Items) { if (item.Text == "Tümü" && item.IsSelected) { continue; } else if (item.IsSelected) { list.Add(item.Value); } } return list; } private ObservableCollection<int> GetComboValuesInt() { ObservableCollection<int> list = new ObservableCollection<int>(); foreach (CheckboxDataItem item in this.cbxCompanies.Items) { if (item.Text == "Tümü" && item.IsSelected) { return null; } else if (item.IsSelected) { list.Add(int.Parse(item.Value)); } } return list; } private void SetComboBox(bool IsCompany) { ComboBoxSource csFirma = new ComboBoxSource(); csFirma.Add(new CheckboxDataItem("All", "Tümü", true, csFirma.IndexBool)); if (IsCompany) { foreach (Company item in Utils.LoggedInUser.AuthenticatedCompanyList) { csFirma.Add( new CheckboxDataItem(item.PK.ToString(), item.CompanyName, true, csFirma.IndexBool)); } } else { foreach (Pergo.Components.PergoWCF.Terminal item in Utils.LoggedInUser.AuthenticatedTerminalList) { csFirma.Add( new CheckboxDataItem(item.TerminalID, item.Long_Name, true, csFirma.IndexBool)); } } this.cbxCompanies.ItemsSource = csFirma; this.cbxCompanies.SelectedIndex = 0; } void client_GetWorkingTimeReportCompleted(object sender, GetWorkingTimeReportCompletedEventArgs e) { if (this.IsMain) { this.grdMonths.ItemsSource = e.Result; this.IsMain = false; this.GetData(cbxMonth.SelectedIndex + 1); } else { this.grdDays.ItemsSource = e.Result; this.IsInitializeCompleted = true; } } private void RadButton_Click(object sender, System.Windows.RoutedEventArgs e) { this.IsInitializeCompleted = false; this.IsMain = true; this.GetData(0); } }}Here Is Content Base
using System;using System.Windows.Controls;using Telerik.Windows.Controls;namespace Pergo.Components.Components{ public class PergoUserControl : UserControl, IDisposable { public EventHandler<Pergo.Components.Components.cClass.Init> isInitializeCompleted; public RadWindow PopUp; private bool IsEnabled_; public bool IsEnabled { get { if (this.IsEnabled_ == null) { return false; } else { return this.IsEnabled_; } } set { this.IsEnabled_ = value; } } public bool IsInitializeCompleted { get { return !(this.PopUp.Content as HelperForm.BusyForm).radBusy.IsBusy; } set { if (value) { this.PopUp.Close(); if (this.isInitializeCompleted != null) { this.isInitializeCompleted(this, new Pergo.Components.Components.cClass.Init { Completed = true }); } } else { try { this.PopUp.Show(); } catch { } } (this.PopUp.Content as HelperForm.BusyForm).radBusy.IsBusy = !value; } } public PergoWCF.WCFClient Client { get { return ComponentUtils.Client; } set { ComponentUtils.Client = value; } } ~PergoUserControl() { this.Dispose(); } public PergoUserControl() { if (System.ComponentModel.DesignerProperties.GetIsInDesignMode(this)) { return; } this.PopUp = new RadWindow { CanClose = false, Height = 200, Width = 200, ResizeMode = Telerik.Windows.Controls.ResizeMode.NoResize, WindowStartupLocation = Telerik.Windows.Controls.WindowStartupLocation.CenterScreen, Opacity = 0.7 ,Header = "Lütfen Bekleyin", CanMove = false }; this.PopUp.Content = new HelperForm.BusyForm(true); this.PopUp.Show(); this.IsInitializeCompleted = false; } public virtual void Dispose() { } }}How can I solve this problem ?