Example #1
0
        private async void DoWork()
        {
            try
            {
                Tenants = Task.Run(async() => await ExedraLibCoreHandler.GetTenantsAsync(EnvironmentT).ConfigureAwait(true)).Result;

                LoadedProjects = true;

                foreach (var tenant in Tenants.Tenants)
                {
                    NDevices += tenant.NDevices;
                }

                NTenants = Tenants.Tenants.Count;

                await Dispatcher.RunAsync(CoreDispatcherPriority.High, () =>
                {
                    TB_NTenants.Text = string.Format(CultureInfo.InvariantCulture, "{0:### ### ###}", NTenants).Trim();
                    TB_NDevices.Text = string.Format(CultureInfo.InvariantCulture, "{0:### ### ###}", NDevices).Trim();

                    UIElementsHandler.DrawScoreElements(GRD_NTenants, 5, 5, NTenants / NGroupedTenants, DefaultScoreBoxWidth, DefaultScoreBoxHeight);
                    UIElementsHandler.DrawScoreElements(GRD_NDevices, 5, 5, NDevices / NGroupedDevices, DefaultScoreBoxWidth, DefaultScoreBoxHeight);

                    CTRL_Animation_Tenants.Stop();
                    CTRL_Animation_Devices.Stop();
                });
            }
            catch (Exception e)
            {
                Debug.WriteLine($"UC_Environment_Item::DoWork()::{e.Message}");
            }
        }
Example #2
0
        public async void BindData()
        {
            BRD_Main.CornerRadius = new CornerRadius(BorderCornerRadius);

            TB_Environment.Text = string.IsNullOrEmpty(Title) ? string.Empty : Title;
            TB_HostName.Text    = string.IsNullOrEmpty(HostName) ? string.Empty : HostName;

            if (!LoadedProjects)
            {
                CTRL_Animation_Tenants.Start();
                CTRL_Animation_Devices.Start();

                await Task.Run(() => DoWork()).ConfigureAwait(false);
            }
        }