public DashboardViewer() { #region Pick Dashboard Windows Service Url ServiceUrl = GetWindowsServiceUrl(); #endregion #region Pick IISExpress or IIS 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. Run DashboardServiceInstaller.exe file to start Dashboard Service in IIS Express"; } } else { ErrorMessage = "Dashboard Service is not running. Run DashboardServiceInstaller.exe file to start Dashboard Service in IIS Express"; ServiceUrl = string.Empty; } } #endregion }
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); }