public bool DashboardStateContains(DashboardState state) { lock (_lock) { return _dashboardState.Contains(state); } }
public bool DashboardStateContains(DashboardState state) { lock (_lock) { return(_dashboardState.Contains(state)); } }
public ActionResult ExportDashboardToPdf(string DashboardID, string DashboardState) { using (MemoryStream stream = new MemoryStream()) { string dashboardID = DashboardID; DashboardState dashboardState = new DashboardState(); dashboardState.LoadFromJson(DashboardState); DashboardPdfExportOptions pdfOptions = new DashboardPdfExportOptions(); pdfOptions.ExportFilters = true; pdfOptions.DashboardStatePosition = DashboardStateExportPosition.Below; string dateTimeNow = DateTime.Now.ToString("yyyyMMddHHmmss"); string serverPath = Server.MapPath(@"~/App_Data/Export"); if (!Directory.Exists(serverPath)) { Directory.CreateDirectory(serverPath); } string filePath = Path.Combine(serverPath, dashboardID); string uniqueId = "_" + dateTimeNow + ".pdf"; var exporter = new WebDashboardExporter(DashboardConfigurator.Default); exporter.ExportToPdf(dashboardID, stream, new System.Drawing.Size(1024, 768), dashboardState, pdfOptions); SaveFile(stream, filePath + uniqueId); ContentResult result = new ContentResult(); result.Content = filePath + uniqueId; return(result); } }
private void DashboardViewer_DashboardStateChanged(object sender, DashboardStateChangedEventArgs e) { state = dashboardViewer.GetDashboardState(); var stateValue = state.SaveToXml().ToString(SaveOptions.DisableFormatting); dashboardViewer.Dashboard.CustomProperties.SetValue("DashboardState", stateValue); }
private void initializemeasure() { string Comm; Comm = "Freq" + " " + "1000" + "Hz"; formattedIO.WriteLine(Comm); labelFreq_Value.Text = "1KHz"; sendCommand("BIAS:STAT 1"); Comm = "BIAS:VOLT " + "0" + "V"; formattedIO.WriteLine(Comm); labelBias_Value.Text = "0"; Comm = "Volt" + " " + "25" + "mV"; formattedIO.WriteLine(Comm); labelLevel_Value.Text = "25mV"; if (rbParallel.Checked == true) { sendCommand("Func:IMP CPG"); } else if (rbSeries.Checked == true) { sendCommand("Func:IMP CSRS"); } sendCommand("APER"); buttonPause.Enabled = true; state = DashboardState.running; MonitorThreadStart = new System.Threading.ThreadStart(CGRmonitor); MonitorThread = new System.Threading.Thread(MonitorThreadStart); MonitorThread.IsBackground = true; MonitorThread.Start(); }
public void SetState(DashboardState state) { DashboardState = state; // Create WidgetContainers one by one from DashbaordState and add them to the CellsContainer for (int containerIter = 0; containerIter < state.WidgetContainerStates.Count; containerIter++) { // Create a new WidgetContainer IWidgetContainer widgetContainer; IWidgetContainerState containerState = state.WidgetContainerStates[containerIter]; if (containerState is WidgetFrameState) { widgetContainer = new WidgetFrame(); } else { widgetContainer = new WidgetFrame(); } // Set the WidgetContainerState widgetContainer.SetState(state.WidgetContainerStates[containerIter]); // Add the WidgetContainer to the Dashboard LayoutManager.AddDashboardWidgetToContainer(CellsContainer, widgetContainer, Changed); } UpdateDashboardAutoFetchState(); ApplyDashboardSettings(); }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { dState = dashboardControl.GetDashboardState(); XElement userData = new XElement("Root", new XElement("DateModified", DateTime.Now), new XElement("DashboardState", dState.SaveToXml().ToString(SaveOptions.DisableFormatting))); dashboardControl.Dashboard.UserData = userData; dashboardControl.Dashboard.SaveToXml("SampleDashboardWithState.xml"); }
private void buttonTest1_Click(object sender, EventArgs e) { buttonPause.Enabled = true; state = DashboardState.running; MonitorThreadStart = new System.Threading.ThreadStart(CGRmonitor); MonitorThread = new System.Threading.Thread(MonitorThreadStart); MonitorThread.IsBackground = true; MonitorThread.Start(); }
private void AddDashboard(DashboardState d) { d.IsPinned = true; var p = new Pin() { BackgroundBrush = Brushes.Black, Id = d.Guid, Title = d.Title }; p.DoUnpin = UnPinDashboard; p.Clicked += (f, e) => { AppState.DashboardStateStates.GoToDashboard(d); }; AppState.Pins.Add(p); AppState.DashboardStateStates.Save(); }
public void EnableDashboardState(DashboardState state) { lock (_lock) { _dashboardState.Push(state); Logger.Debug("Enabled " + _dashboardState.Peek() + ", " + _dashboardState.Count + " states now"); } OnPropertyChanged("DashboardState"); }
public DashboardState InitializeDashboardState() { DashboardState dashboardState = new DashboardState(); DashboardParameterState parameterState = new DashboardParameterState("CustomerIdDashboardParameter", "XXX", typeof(string)); dashboardState.Parameters.Add(parameterState); return(dashboardState); }
public void UnPin(DashboardState d) { var pin = AppState.Pins.FirstOrDefault(k => k.Id == d.Guid); if (pin != null) { AppState.Pins.Remove(pin); d.IsPinned = false; } AppState.DashboardStateStates.Save(); }
private void Dashboard_SetInitialDashboardState(object sender, SetInitialDashboardStateEventArgs e) { string stateJson = LoadDashboardState(); if (!string.IsNullOrWhiteSpace(stateJson)) { DashboardState state = new DashboardState(); state.LoadFromJson(stateJson); e.InitialState = state; } }
DashboardState GetDataFromString(string customPropertyValue) { DashboardState dState = new DashboardState(); if (!string.IsNullOrEmpty(customPropertyValue)) { var xmlStateEl = XDocument.Parse(customPropertyValue); dState.LoadFromXml(xmlStateEl); } return(dState); }
DashboardState GetStateFromCustomProperty() { var customPropertyValue = dashboardViewer1.Dashboard.CustomProperties.GetValue(PropertyName); DashboardState state = new DashboardState(); if (!string.IsNullOrEmpty(customPropertyValue)) { var xmlStateEl = XDocument.Parse(customPropertyValue); state.LoadFromXml(xmlStateEl); } return(state); }
public void SetDashboard(ref DashboardState dashboard) { var r = ""; foreach (WebTileLayer bl in AppState.ViewDef.BaseLayers) { r += bl.TileProvider.Title + "|" + bl.TileProvider.MBTileFile + "|" + bl.Opacity.ToString(CultureInfo.InvariantCulture) + ";"; } dashboard.States[BasemapState] = r; dashboard.States[ExtentState] = new EnvelopeConverter().ConvertToString(AppState.ViewDef.MapControl.Extent.ToString()); dashboard.States[RotationState] = AppState.ViewDef.MapControl.Rotation.ToString(CultureInfo.InvariantCulture); }
public void Pin(DashboardState state) { if (state == null) return; if (!state.IsPinned) { AddDashboard(state); } else { UnPin(state); } }
private void DashboardSettings_Click(object sender, RoutedEventArgs e) { DashboardSettingsWindow editor = new DashboardSettingsWindow(DashboardState); editor.ShowDialog(); if (editor.DialogResult == true) { // change the settings of the dashboard DashboardState.SetSettings(editor.DashboardState); ApplyDashboardSettings(); } }
private void dashboardViewer1_SetInitialDashboardState(object sender, SetInitialDashboardStateEventArgs e) { DashboardState state = new DashboardState(); DashboardParameterState parameters = new DashboardParameterState(); parameters.Name = "customerIdParameter"; parameters.Value = new List <string>() { "ALFKI", "AROUT", "BONAP" }; state.Parameters.Add(parameters); e.InitialState = state; }
protected void ASPxDashboard1_SetInitialDashboardState(object sender, SetInitialDashboardStateEventArgs e) { HttpCookie cookie = Request.Cookies["ASPxDashboardState"]; if (cookie != null) { DashboardState dashboardState = new DashboardState(); dashboardState.LoadFromJson(HttpUtility.UrlDecode(cookie.Value)); if (e.DashboardId == "dashboard1") { e.InitialState = dashboardState; } } }
public DashboardState InitializeDashboardState() { DashboardState dashboardState = new DashboardState(); DashboardParameterState parameterState = new DashboardParameterState("OrderID", "10253", typeof(int)); DashboardItemState gridFilterState = new DashboardItemState("gridDashboardItem1"); gridFilterState.MasterFilterValues.Add(new object[] { 10253, "Hanari Carnes" }); dashboardState.Parameters.Add(parameterState); dashboardState.Items.Add(gridFilterState); return(dashboardState); }
public DashboardState GetState(string dashboardId, XDocument dashboard) { HttpCookie cookie = HttpContext.Current.Request.Cookies["MVCxDashboardState"]; if (cookie != null) { DashboardState dashboardState = new DashboardState(); dashboardState.LoadFromJson(HttpUtility.UrlDecode(cookie.Value)); return(dashboardState); } else { return(null); } }
private DashboardState GenerateState() { DashboardState state = DashboardState; // Create WidgetContainerStates and append to list DashboardState.WidgetContainerStates.Clear(); for (int widgetContIter = 0; widgetContIter < CellsContainer.Children.Count; widgetContIter++) { IWidgetContainer container = (IWidgetContainer)CellsContainer.Children[widgetContIter]; IWidgetContainerState containerState = container.GenerateState(); DashboardState.WidgetContainerStates.Add(containerState); } return(state); }
public void OpenFileName(string str) { if (str != null) { // Generate the dashboard state DashboardState dashboardState = JsonConvert.DeserializeObject <DashboardState>(File.ReadAllText(str)); Console.WriteLine($"Dashboard State \"{dashboardState.Name}\" loaded"); // Clean up the Dashboard by deleting all the widget containers DeleteAllWidgets(); // Create WidgetFrames based on the Dashboard state SetState(dashboardState); } }
private void buttonConn_Click(object sender, EventArgs e) { if (openGPIB()) { pictureConn.Image = global::TesterAutomation_Dashboard.Properties.Resources.green; labelConn_Value.Text = "Success"; GPIBstatus = true; } else { pictureConn.Image = global::TesterAutomation_Dashboard.Properties.Resources.red; labelConn_Value.Text = "Fail"; GPIBstatus = false; state = DashboardState.noconnection; } }
private static void AppendDashboardItemCell( HtmlContentBuilder content, string mainClass, string text, string url, DashboardState state) { content.AppendFormat("<td class='ra-dashboard-cell-value-{0} ra-dashboard-cell-{1} {2}'", mainClass, state.ToString().ToLower(), !String.IsNullOrEmpty(url) ? "ra-clickable" : null); if (!String.IsNullOrEmpty(url)) { content.AppendFormat(" onmouseup='navigateTo(\"{0}\");'", url); } content.AppendFormat(">{0}</td><td class='ra-dashboard-cell-spacer'></td>", text); }
private void buttonSubmit_Click(object sender, EventArgs e) { if (state == DashboardState.running) { MonitorThread.Abort(); } string Comm; if (!GPIBstatus) { MessageBox.Show("Please Connect Instrument.", "No GPIB Connection", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } Comm = "BIAS:VOLT " + txtMeasVoltage.Text + "V"; formattedIO.WriteLine(Comm); labelBias_Value.Text = txtMeasVoltage.Text + "V"; Comm = "Volt" + " " + txtOscVoltage.Text + "mV"; labelLevel_Value.Text = txtOscVoltage.Text + "mV"; formattedIO.WriteLine(Comm); if (rbParallel.Checked == true) { sendCommand("Func:IMP CPG"); } else if (rbSeries.Checked == true) { sendCommand("Func:IMP CSRS"); } sendCommand("APER"); Comm = "Freq" + " " + txtFrequency.Text + "Hz"; formattedIO.WriteLine(Comm); labelFreq_Value.Text = txtFrequency.Text + "Hz"; sendCommand("BIAS:STAT 1"); pictureState.Image = global::TesterAutomation_Dashboard.Properties.Resources.green; labelState_Value.Text = "Running"; buttonPause.Enabled = true; state = DashboardState.running; MonitorThreadStart = new System.Threading.ThreadStart(CGRmonitor); MonitorThread = new System.Threading.Thread(MonitorThreadStart); MonitorThread.IsBackground = true; MonitorThread.Start(); }
void InitPage() { dState = new DashboardState(); company = api.CompanyEntity; InitializeComponent(); this.BusyIndicator = busyIndicator; dashboardViewerUniconta.ObjectDataSourceLoadingBehavior = DevExpress.DataAccess.DocumentLoadingBehavior.LoadAsIs; dataSourceAndTypeMap = new Dictionary <string, Type>(); lstOfFilters = new Dictionary <string, IEnumerable <PropValuePair> >(); lstOfNewFilters = new Dictionary <string, List <FilterProperties> >(); lstOfSorters = new Dictionary <string, FilterSorter>(); ListOfReportTableTypes = new Dictionary <int, Type[]>(); LoadListOfTableTypes(company); dashboardViewerUniconta.Loaded += DashboardViewerUniconta_Loaded; dashboardViewerUniconta.DashboardLoaded += DashboardViewerUniconta_DashboardLoaded; dashboardViewerUniconta.SetInitialDashboardState += DashboardViewerUniconta_SetInitialDashboardState; dashboardViewerUniconta.DashboardChanged += DashboardViewerUniconta_DashboardChanged; dashboardViewerUniconta.DataLoadingError += DashboardViewerUniconta_DataLoadingError; dashboardViewerUniconta.Unloaded += DashboardViewerUniconta_Unloaded; }
protected void ASPxDashboard1_CustomDataCallback(object sender, DevExpress.Web.CustomDataCallbackEventArgs e) { using (MemoryStream stream = new MemoryStream()) { string selectedDashboardID = e.Parameter.Split('|')[0]; string dashboardStateJson = e.Parameter.Split('|')[1]; DashboardState dashboardState = new DashboardState(); dashboardState.LoadFromJson(dashboardStateJson); DashboardPdfExportOptions pdfOptions = new DashboardPdfExportOptions(); pdfOptions.ExportFilters = true; pdfOptions.DashboardStatePosition = DashboardStateExportPosition.Below; string dateTimeNow = DateTime.Now.ToString("yyyyMMddHHmmss"); string filePath = "~/App_Data/Export/" + selectedDashboardID + "_" + dateTimeNow + ".pdf"; ASPxDashboardExporter exporter = new ASPxDashboardExporter(ASPxDashboard1); exporter.ExportToPdf(selectedDashboardID, stream, new System.Drawing.Size(1920, 1080), dashboardState, pdfOptions); SaveFile(stream, filePath); e.Result = filePath; } }
public DashboardState CreateDashboardState() { DashboardState state = new DashboardState(); // Set a range for a Range Filter. state.Items.Add(new DashboardItemState("rangeFilterDashboardItem1") { RangeFilterState = new RangeFilterState(new RangeFilterSelection(new DateTime(2015, 1, 1), new DateTime(2017, 1, 1))) }); // Specify master filter and drill-down values. state.Items.Add(new DashboardItemState("gridDashboardItem1") { MasterFilterValues = new List <object[]>() { new object[] { "Gravad lax" }, new object[] { "Ikura" } }, DrillDownValues = new List <object>() { "Seafood" } }); // Set a dashboard item layer. state.Items.Add(new DashboardItemState("treemapDashboardItem1") { SelectedLayerIndex = 1 }); // Specify a default tab page. state.Items.Add(new DashboardItemState("tabContainerDashboardItem1") { TabPageName = "dashboardTabPage2" }); // Define a dashboard parameter value. state.Parameters.Add(new DashboardParameterState() { Name = "ParameterCountry", Value = "UK", Type = typeof(string) }); return(state); }
public IActionResult Index() { DashboardState dashboardState = new DashboardState(); DashboardParameterState parameterState = new DashboardParameterState("countryParameter", "USA", typeof(string)); DashboardItemState gridFilterState = new DashboardItemState("gridDashboardItem1"); gridFilterState.MasterFilterValues.AddRange(new List <object[]>() { new string[1] { "Andrew Fuller" }, new string[1] { "Laura Callahan" } } ); DashboardItemState treemapDrilldownState = new DashboardItemState("treemapDashboardItem1"); treemapDrilldownState.DrillDownValues.Add("Beverages"); DashboardItemState rangeFilterState = new DashboardItemState("rangeFilterDashboardItem1"); rangeFilterState.RangeFilterState.Selection = new RangeFilterSelection(new DateTime(2015, 1, 1), new DateTime(2016, 1, 1)); dashboardState.Parameters.Add(parameterState); dashboardState.Items.AddRange(new List <DashboardItemState>() { gridFilterState, treemapDrilldownState, rangeFilterState } ); return(View(dashboardState)); }
public void DisableDashboardState(DashboardState state) { lock (_lock) { if (_dashboardState.Contains(state)) { _dashboardStateRequests.Add(state); while (_dashboardStateRequests.Contains(_dashboardState.Peek())) { Logger.Debug("Disabling " + _dashboardState.Peek()); _dashboardStateRequests.Remove(_dashboardState.Pop()); Logger.Debug(_dashboardState.Count + " states now, " + _dashboardState.Peek() + " top."); } } else { Logger.Warn("Failed to process disable dashboard state request " + state + ", we don't have that state enabled on any level."); } } OnPropertyChanged("DashboardState"); }
public ActionResult ExportDashboardToPdf(string DashboardID, string DashboardState) { using (MemoryStream stream = new MemoryStream()) { string dashboardID = DashboardID; DashboardState dashboardState = new DashboardState(); dashboardState.LoadFromJson(DashboardState); DashboardPdfExportOptions pdfOptions = new DashboardPdfExportOptions(); pdfOptions.ExportFilters = true; pdfOptions.DashboardStatePosition = DashboardStateExportPosition.Below; string dateTimeNow = DateTime.Now.ToString("yyyyMMddHHmmss"); string filePath = "~/App_Data/Export/" + dashboardID + "_" + dateTimeNow + ".pdf"; ASPxDashboardExporter exporter = new ASPxDashboardExporter(DashboardConfigurator.Default); exporter.ExportToPdf(dashboardID, stream, new System.Drawing.Size(1024, 768), dashboardState, pdfOptions); SaveFile(stream, filePath); ContentResult result = new ContentResult(); result.Content = filePath; return(result); } }
public void DisableDashboardState(DashboardState state) { lock (_lock) { if (_dashboardState.Contains(state)) { _dashboardStateRequests.Add(state); while (_dashboardStateRequests.Contains(_dashboardState.Peek())) { Logger.Debug("Disabling " + _dashboardState.Peek()); _dashboardStateRequests.Remove(_dashboardState.Pop()); Logger.Debug(_dashboardState.Count + " states now, " + _dashboardState.Peek() + " top."); } } else { Logger.Warn("Failed to process disable dashboard state request " + state + ", we don't have that state enabled on any level."); } } OnPropertyChanged("DashboardState"); }
protected void ASPxButton1_Click(object sender, EventArgs e) { if (ASPxHiddenField1.Get("dashboardState") != null && ASPxHiddenField1.Get("filterItems") != null) { string dashboardStateJson = ASPxHiddenField1.Get("dashboardState").ToString(); string[] parameters = ASPxHiddenField1.Get("filterItems").ToString().Split('|'); MemoryStream resultStream = new MemoryStream(); using (PdfDocumentProcessor documentProcessor = new PdfDocumentProcessor()) { documentProcessor.CreateEmptyDocument(resultStream); for (int i = 0; i < parameters.Length; i++) { DashboardState dashboardState = new DashboardState(); dashboardState.LoadFromJson(dashboardStateJson); var filterItemState = dashboardState.Items.Where(item => item.ItemName == "comboBoxDashboardItem1").FirstOrDefault(); if (filterItemState != null) { filterItemState.MasterFilterValues.Clear(); filterItemState.MasterFilterValues.Add(new object[] { parameters[i] }); } DashboardPdfExportOptions pdfOptions = new DashboardPdfExportOptions(); pdfOptions.ShowTitle = DevExpress.Utils.DefaultBoolean.False; ASPxDashboardExporter exporter = new ASPxDashboardExporter(ASPxDashboard1); using (MemoryStream stream = new MemoryStream()) { exporter.ExportToPdf("Dashboard1", stream, new System.Drawing.Size(1024, 768), dashboardState, pdfOptions); documentProcessor.AppendDocument(stream); } } } resultStream.Seek(0, SeekOrigin.Begin); Page.Response.Clear(); Page.Response.ContentType = "application/pdf"; Response.BinaryWrite(resultStream.ToArray()); Page.Response.End(); } }
private void SaveDashboard() { DashboardState state = GenerateState(); // get the filename string filename = DashboardState.Name; string jsonText = JsonConvert.SerializeObject(DashboardState, Formatting.Indented); SaveFileDialog savefileDialog = new SaveFileDialog { // set a default file name FileName = filename, // set filters - this can be done in properties as well Filter = "dash Files (*.dash)|*.dash|All files (*.*)|*.*" }; if (savefileDialog.ShowDialog() == true) { File.WriteAllText(savefileDialog.FileName, jsonText); Console.WriteLine("Saved the updated dashboard file!!!"); } //if (MessageBox.Show("Save this Dashboard?", "Save", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) //{ //} }
public void SetDashboard(ref DashboardState dashboard) { var res = ""; foreach (var service in Dsb.Services.Where(k => k is PoiService && k.IsFileBased)) { var s = (PoiService)service; res += s.RelativeFolder + "|" + s.Id + "|" + s.Name + "|" + s.StaticService + "|" + s.IsSubscribed + "|"; if (s.Layer != null) { var l = s.Layer; res += l.Visible + "|" + l.Opacity.ToString(CultureInfo.InvariantCulture) + "|"; var startStopLayer = s.Layer as IStartStopLayer; if (startStopLayer != null) res += startStopLayer.IsStarted + "|"; if (s.Layer.ChildLayers.Any()) { foreach (var sl in s.Layer.ChildLayers) { res += sl.ID + "_" + sl.Visible + "_" + sl.Opacity.ToString(CultureInfo.InvariantCulture) + ";"; } } } res += "~"; } dashboard.States["Layers"] = res; }
public void RemoveDashboard(DashboardState d) { if (d.IsPinned) UnPin(d); AppState.DashboardStateStates.RemoveDashboard(d); NotifyOfPropertyChange(() => Dashboards); }
public void EnableDashboardState(DashboardState state) { lock (_lock) { _dashboardState.Push(state); Logger.Debug("Enabled " + _dashboardState.Peek() + ", " + _dashboardState.Count + " states now"); } OnPropertyChanged("DashboardState"); }
public void GoToDashboard(DashboardState d) { AppState.DashboardStateStates.GoToDashboard(d); }