public void Serialize(DashboardServicePreviewSettings settings, string path)
 {
     try
     {
         using (StreamWriter writer = new StreamWriter(path))
         {
             previewSerializer.Serialize(writer, settings);
         }
     }
     catch (Exception)
     {
     }
 }
        public DashboardServicePreviewSettings Deserialize(string path)
        {
            DashboardServicePreviewSettings settings = new DashboardServicePreviewSettings();

            try
            {
                using (StreamReader reader = new StreamReader(path))
                {
                    settings = (DashboardServicePreviewSettings)previewSerializer.Deserialize(reader);
                }
            }
            catch (Exception)
            {
            }
            return(settings);
        }
示例#3
0
        public DashboardViewer()
        {
            #region Pick Windows Dashboard Service Url

            ServiceUrl = GetWindowsServiceUrl();

            #endregion Pick Windows Dashboard Service Url

            #region Pick IIS Express Dashboard Service Url if Windows Dashboard Service is not running

            if (ValidateDashboardService(ServiceUrl))
            {
                DashboardServiceSerialization   serializer = new DashboardServiceSerialization();
                DashboardServicePreviewSettings settings   = new DashboardServicePreviewSettings();
                string dashboardServiceSettingPath         = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Syncfusion\Dashboard Platform SDK\" + Version + @"\DashboardServiceSetting.xml";
                if (File.Exists(dashboardServiceSettingPath))
                {
                    settings = serializer.Deserialize(dashboardServiceSettingPath);
                    if (!ValidateDashboardService(settings.ServiceURL))
                    {
                        ServiceUrl = settings.ServiceURL;
                    }
                    else
                    {
                        ServiceUrl   = string.Empty;
                        Errormessage = "Dashboard Service is not running. Please start the DashboardServiceInstaller.exe file to start the service.";
                    }
                }
                else
                {
                    Errormessage = "Dashboard Service is not running. Please start the DashboardServiceInstaller.exe file to start the service.";
                    ServiceUrl   = string.Empty;
                }
            }

            #endregion Pick IIS Express Dashboard Service Url if Windows Dashboard Service is not running
        }