private void DashboardViewerUniconta_DashboardLoaded(object sender, DevExpress.DashboardWpf.DashboardLoadedEventArgs e)
        {
            Dashboard dasdboard = e.Dashboard;

            foreach (var item in dasdboard?.Items)
            {
                var name = dasdboard?.CustomProperties.GetValue(item.ComponentName);
                if (name != null)
                {
                    if (name[0] == '&')
                    {
                        item.Name = Uniconta.ClientTools.Localization.lookup(name.Substring(1));
                    }
                    ;
                }
            }

            if (!dasdboard.Title.ShowMasterFilterState)
            {
                rowFilter.Visibility = Visibility.Collapsed;
            }

            XElement data = e.Dashboard.UserData;

            if (data != null)
            {
                var state = data.Element("DashboardState");
                if (state != null)
                {
                    dState.LoadFromXml(XDocument.Parse(state.Value));
                }

                var fixedComps = data.Element("FixedCompanies");
                if (fixedComps != null)
                {
                    fixedCompanies = null;
                    var rootelement = XElement.Parse(fixedComps.ToString());
                    foreach (var el in rootelement.Elements())
                    {
                        var fxdComps = XDocument.Parse(el.ToString()).Elements("FixedCompany")
                                       .Select(p => new FixedCompany
                        {
                            CompanyId      = int.Parse(p.Element("CompanyId").Value),
                            DatasourceName = p.Element("DatasourceName").Value
                        }).ToList();
                        if (fixedCompanies != null)
                        {
                            fixedCompanies.AddRange(fxdComps);
                        }
                        else
                        {
                            fixedCompanies = fxdComps;
                        }
                    }

                    if (fixedCompanies != null)
                    {
                        for (int i = 0; i < fixedCompanies.Count; i++)
                        {
                            var comp     = CWDefaultCompany.loadedCompanies.FirstOrDefault(x => x.CompanyId == fixedCompanies[i].CompanyId) as Company;
                            var openComp = OpenFixedCompany(comp).GetAwaiter().GetResult();
                            if (openComp != null)
                            {
                                openComp.GenerateUserType();
                                LoadListOfTableTypes(openComp);
                            }
                            else
                            {
                                UnicontaMessageBox.Show(Uniconta.ClientTools.Localization.lookup("UserNoAccessToCompany"), Uniconta.ClientTools.Localization.lookup("Information"));
                            }
                        }
                    }
                }

                var ldOnOpn = data.Element("LoadOnOpen");
                if (ldOnOpn != null)
                {
                    LoadOnOpen = bool.Parse(ldOnOpn.Value);
                }

                var userId = data.Element("LogedInUserIdFilter");
                if (userId != null)
                {
                    UserIdPropName = userId.Value;
                }

                var filters = data.Element("Filters");
                if (filters != null)
                {
                    var filtersBytes = Convert.FromBase64String(filters.Value);
                    var r            = StreamingManagerReuse.Create(filtersBytes);
                    int version      = r.readByte();
                    if (version != 0)
                    {
                        if (version < 3 && r.readBoolean())
                        {
                            int filterCount = (int)StreamingManager.readNum(r);
                            for (int i = 0; i < filterCount; i++)
                            {
                                var key = r.readString();
                                List <PropValuePair> propVal = new List <PropValuePair>();
                                var arrpropval = (PropValuePair[])r.ToArray(typeof(PropValuePair));
                                propVal = arrpropval.ToList();
                                lstOfFilters.Add(key, arrpropval);
                            }
                        }
                        else
                        {
                            int filterCount = (int)StreamingManager.readNum(r);
                            for (int i = 0; i < filterCount; i++)
                            {
                                var key       = r.readString();
                                var arrFilter = (FilterProperties[])r.ToArray(typeof(FilterProperties));
                                lstOfNewFilters.Add(key, arrFilter.ToList());
                            }
                        }
                    }
                    if (r.readBoolean())
                    {
                        if (version < 3)
                        {
                            int sortCount = (int)r.readNum();
                            for (int i = 0; i < sortCount; i++)
                            {
                                var          key      = r.readString();
                                var          arrSort  = (SortingProperties[])r.ToArray(typeof(SortingProperties));
                                FilterSorter propSort = new FilterSorter(arrSort);
                                lstOfSorters.Add(key, propSort);
                            }
                        }
                    }
                    r.Release();
                }
            }
            else
            {
                LoadOnOpen = true;  // for old saved dashboards
            }
            if (LoadOnOpen)
            {
                foreach (var ds in e.Dashboard.DataSources)
                {
                    dataSourceLoadingParams.Add(ds.ComponentName);
                }
            }
        }