예제 #1
0
        public void BindData(Tenant project, EnvironmentHandler.Type environment)
        {
            if (project is null)
            {
                return;
            }

            MapLayers = new List <MapElementsLayer>();

            Project      = project;
            EnvironmentT = environment;

            var area      = GeopositionHandler.GetAreaInKmFromCoordinates(Project.Coordinates, 1);
            var perimeter = GeopositionHandler.GetPerimeterInKmFromCoordinates(Project.Coordinates, 1);

            var projectName       = TextHandler.GetOnlyAlphabetChars(Project.Name);
            var projectNameLength = Math.Min(projectName.Length, 3);

            TB_Title_Prefix.Text = projectNameLength > 0 ? projectName.Substring(0, projectNameLength).ToUpperInvariant() : string.Empty;
            TB_ProjectName.Text  = Project.Name;
            TB_Title.Text        = Project.Name;
            TB_Timezone.Text     = Project.Timezone;
            TB_NDevices.Text     = Project.NDevices.ToString(CultureInfo.InvariantCulture);
            TB_Area.Text         = string.Format(CultureInfo.InvariantCulture, "{0:### ### ###.#}", area);
            TB_Perimeter.Text    = string.Format(CultureInfo.InvariantCulture, "{0:### ### ###.#}", perimeter);
            FillColor            = ColorHandler.FromHex(Project.FillColor, Project.FillOpacity * 255);

            BRD_Info_BT.Background    = new SolidColorBrush(ColorHandler.FromHex(Project.FillColor, 200));
            BRD_Info_Title.Background = new SolidColorBrush(ColorHandler.FromHex(Project.FillColor, 200));

            Scheduler.Start();

            if (!MapControlLoaded)
            {
                InitializeMapControl();
            }
        }