This is a migrated thread and some comments may be shown as answers.

Rad Docking Performans Problem

3 Answers 75 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Murat
Top achievements
Rank 1
Murat asked on 29 Jun 2011, 04:48 PM
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.

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"                  
    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 ?

3 Answers, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 01 Jul 2011, 08:50 AM
Hi Murat,

 When the panes of the Docking control are closed they actually stay in the Docking control (they are just hidden). In order to dispose them you need to remove them from their PaneGroup. In this case we are aware of an issue with the last pane in the group - it is not disposed until another pane is placed in the group, but this happens only for the last pane. This issue is fixed in the Beta version we recently released.

Hope this information is helpful.

Best wishes,
Miroslav Nedyalkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Murat
Top achievements
Rank 1
answered on 04 Jul 2011, 08:59 AM
Im already removing Radpane from the parent RadpaneGroup but Problem is not solved for me.
Its same, memory usage is increasing again.
You can see details on example code.
Your explanation Is not helpfull for me but thanks anyway.
0
Miroslav Nedyalkov
Telerik team
answered on 07 Jul 2011, 04:04 PM
Hi Murat,

 Could you please prepare a sample project that demonstrates the performance problem you are observing and to give us some instructions how to observe the problem? This will help us identify the source of the problem and to help you overcome it.

Kind regards,
Miroslav Nedyalkov
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Docking
Asked by
Murat
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Murat
Top achievements
Rank 1
Share this question
or