void SetLayout(LayoutTypeEnum type) { ServiceProvider.Settings.SelectedLayout = type.ToString(); switch (type) { case LayoutTypeEnum.Normal: { StackLayout.Children.Clear(); LayoutNormal control = new LayoutNormal(); StackLayout.Children.Add(control); } break; case LayoutTypeEnum.Grid: { StackLayout.Children.Clear(); LayoutGrid control = new LayoutGrid(); StackLayout.Children.Add(control); } break; case LayoutTypeEnum.GridRight: { StackLayout.Children.Clear(); LayoutGridRight control = new LayoutGridRight(); StackLayout.Children.Add(control); } break; } }
/// <summary> /// Serialization constructor for views. /// </summary> /// <param name="info">Serialization state information.</param> /// <param name="context">Streaming context information.</param> protected MyView(SerializationInfo info, StreamingContext context) { this.dpiX = 96; this.dpiY = 96; m_ptOrigin = (PointF)info.GetValue("origin", typeof(PointF)); m_fMagnification = info.GetSingle("magnification"); m_stylePageBorder = (PageBorderStyle)info.GetValue("pageborderstyle", typeof(PageBorderStyle)); m_grid = (LayoutGrid)info.GetValue("m_grid", typeof(LayoutGrid)); try { backgroundColor = (Color)info.GetValue("backcolor", typeof(Color)); } catch (SerializationException) { ResetBackgroundColor(); m_grid.Visible = false; } if (m_grid != null) { m_grid.ContainerView = this; m_grid.UpdateServiceReferences(this); } }
//--construction--// /// <summary> /// public form constructor. /// </summary> /// <param name="name"></param> public Form(string name, string verboseName) : base(name) { this.verboseName = verboseName; this.stackPanel = new StackPanel(); this.elementList = new List <FormElement>(); this.facilityNameField = new ControlText("facilityName", "ASSISTED LIVING FACILITY NAME"); this.facilityNameField.SetReadOnly(true); this.facilityNoField = new ControlInteger("licensNumber", "LICENSE NUMBER"); this.facilityNoField.SetReadOnly(true); this.licensorNameField = new ControlText("licensorName", "LICENSOR NAME"); this.licensorNameField.SetReadOnly(true); this.inspectionDateControl = new ControlDate("inspectionDate", "INSPECTION DATE"); //this.inspectionDateControl.SetValue(new DateTime(1999, 1, 1)); LayoutGrid headerGrid = new LayoutGrid("header"); headerGrid.AddElement(this.facilityNameField, 0, 0, 9); headerGrid.AddElement(this.facilityNoField, 9, 0, 3); headerGrid.AddElement(this.inspectionDateControl, 0, 1, 3); headerGrid.AddElement(this.licensorNameField, 3, 1, 9); this.stackPanel.Children.Add(headerGrid.UIelement); this.SetHeaderValues(); //be aware of new data if it's entered this.isSaved = true; //this.onDataEntered += this.OnDataEnteredHandler(); }
private void SetItemIndex(int position) { int count = LayoutGrid.Children.Count; LayoutGrid.SetIndex(LayoutGrid.Children[count - 1], position); LayoutGrid.PreparePersistedPanel(LayoutGrid.Children[count - 1]); }
private void OnSaveClick(object sender, RoutedEventArgs e) { var stringName = tbReportName.Text; var isShowChannelSelector = CheckBoxChannels.IsChecked.GetValueOrDefault(); if (string.IsNullOrEmpty(stringName) || stringName == "<Новый отчет>") { var businessObjects = StiBusinessObjectHelper.GetUsedBusinessObjectsNames(DesignerControl.Report); if (businessObjects == null || businessObjects.Count == 0) { Manager.UI.ShowMessage("Задайте осмысленное название отчета"); return; } foreach (var key in businessObjects.Keys) { var businessObject = businessObjects[key]; //Тип бизнес объекта в отчете stringName = tbReportName.Text = businessObject.ToString(); break; //Имеет смысл использовать только один бизнес объект в отчете } } var data = new MemoryStream(); DesignerControl.Report.Save(data); var reportInfo = new TReportInfo { ReportUn = _reportUn, StringName = stringName, UserId = Manager.User.User_ID, Data = data.ToArray().EncodeBuffer(), DateRangeMode = DateRangeMode, TreeMode = TreeMode, IsShowChannelSelector = isShowChannelSelector, }; data.Dispose(); LayoutGrid.RunBackgroundAsync <string>("SaveReport", reportUn => { if (!string.IsNullOrEmpty(reportUn)) { _reportUn = reportUn; Manager.UI.ShowMessage("Отчет успешно сохранен"); } }, EnumServiceType.StimulReport, reportInfo); }
private void WCFTestConnection(object sender, Stimulsoft.Report.Events.StiWCFEventArgs e) { if (!Equals(sender, DesignerControl)) { return; } var testConnecting = sender as IStiTestConnecting; if (testConnecting == null) { return; } LayoutGrid.RunBackgroundAsync <string>("TestConnection", testConnecting.ApplyResultAfterTestConnection, EnumServiceType.StimulReport, e.Xml); }
//private void WCFRetrieveColumns(object sender, Stimulsoft.Report.Events.StiWCFEventArgs e) //{ // if (!Equals(sender, DesignerControl)) return; // var dataStoreSourceEditWindow = sender as StiDataStoreSourceEditWindow; // if (dataStoreSourceEditWindow == null) return; // LayoutGrid.RunBackgroundAsync<string>("RetrieveColumns", dataStoreSourceEditWindow.ApplyResultAfterRetrieveColumns, EnumServiceType.StimulReport, e.Xml); //} private void WCFBuildObjects(object sender, Stimulsoft.Report.Events.StiWCFEventArgs e) { if (!Equals(sender, DesignerControl)) { return; } var selectDataWindow = sender as StiSelectDataWindow; if (selectDataWindow == null) { return; } LayoutGrid.RunBackgroundAsync <string>("BuildObjects", selectDataWindow.ApplyResultAfterBuildObjects, EnumServiceType.StimulReport, e.Xml); }
private void UpdateDrag(InputEvent @event) { if (@event is InputEventMouseMotion eventMouseMotion) { var newPosition = eventMouseMotion.Position - dragStart; if (ModelView.SnapToGrid && LayoutGrid.TryFindSnapPoint(newPosition, out Vector2 snapPoint)) { newPosition = snapPoint; } EmitSignal(nameof(PositionChanged), newPosition); } else if (@event is InputEventMouseButton eventMouseButton && !eventMouseButton.Pressed) { dragging = false; } }
public override void Initialize() { var l1 = new AbsoluteLayout(10, 10, 300, 300, Color.White); var l2 = new AbsoluteLayout(10, 10, 100, 100, Color.Green); l1.AddComponent(l2); var tb = new TextBlock(50, 20, "STAS", "Arial", 11, StringAlignment.Center, Color.Black); var button = new ButtonCircle(10, 20, 25, new Font("Arial", 10), "BUTTON", Color.FromArgb(50, 50, 50)); l2.AddComponent(button); l1.ListenerMouse.AddDown((m) => { Console.WriteLine(m.UI); }); AddComponent(l1); LayoutGrid grid = new LayoutGrid(400, 100, 400, 400, Color.FromArgb(0, 0, 0)); grid.InitGrid(2, 2); grid.AddComponent(0, 0, new AbsoluteLayout(0, 0, 10, 10, Color.Green)); grid.AddComponent(1, 0, new AbsoluteLayout(0, 0, 10, 10, Color.Red)); grid.AddComponent(0, 1, new AbsoluteLayout(0, 0, 10, 10, Color.Blue)); grid.AddComponent(1, 1, new AbsoluteLayout(0, 0, 10, 10, Color.Gray)); this.AddComponent(grid); Window win = new Window(400, 400, 500, 500, "My Window"); var scroll = new Scroll(10, 150, 100); var lsb = new ListBox(200, 200, 200, 200); scroll.ChangeScroll += (o, e) => { win.Title.Value = scroll.Value.ToString(); }; win.AddComponent(lsb); lsb.AddItem(new ButtonRect(0, 0, 20, 40, new Font("Arial", 12), "Sta", Color.Blue)); this.AddComponent(win); var tabs = new TabLayout <TextBlock>(100, 100, 400, 30, Color.Silver); this.AddComponent(tabs); for (int i = 0; i < 3; i++) { tabs.AddTab($"File {i}.cs", new TextBlock(10, 10, "1", "Arial", 14, StringAlignment.Center, Color.Red)).Active = (name, ui) => { Console.WriteLine("name: " + name); } } ; }
/// <summary> /// Расчитываем отчет /// </summary> private void RenderReport(MultiPsSelectedArgs args) { BusinessObjectHelper.BuildBusinessObjectsParams(_businessObjectName, args); LayoutGrid.RunAsync(() => { string result = string.Empty; try { var errs = new StringBuilder(); result = StimulReportsProcedures.RenderReport(_xml, errs, args, Manager.Config.TimeZone); if (errs.Length > 0) { Manager.UI.ShowMessage(errs.ToString()); } } catch (Exception ex) { Manager.UI.ShowMessage(ex.Message); } return(result); }, rendered => { if (string.IsNullOrEmpty(rendered) || rendered.Length <= 2) { return; } _businessObjectName = string.Empty; _xml = null; try { DesignerControl.ApplyRenderedReport(rendered); } catch (Exception ex) { Manager.UI.ShowMessage(ex.Message); } }); }
private void SaveButton_Click(object sender, RoutedEventArgs e) { foreach (UIElement child in LayoutGrid.Children) { if (child is DragDockPanel) { //ddPanelProperty.Header=((DragDockPanel)child).Header as string; foreach (PersistPreference item in userPreference) { if (item.Content.Equals(child)) { item.Position = LayoutGrid.GetIndex(child); item.Content = ((string)item.Header).Split(' ')[0]; } } } } string strSer = Serializer.Serialize <List <PersistPreference> >(userPreference); UpdateUserPref(1, strSer); }
private void SetLayout(LayoutTypeEnum type) { ServiceProvider.Settings.SelectedLayout = type.ToString(); if (StackLayout.Children.Count > 0) { var cnt = StackLayout.Children[0] as LayoutBase; if (cnt != null) { cnt.UnInit(); } } switch (type) { case LayoutTypeEnum.Normal: { StackLayout.Children.Clear(); LayoutNormal control = new LayoutNormal(); PreviewPanel.DataContext = control.ZoomAndPanControl; StackLayout.Children.Add(control); } break; case LayoutTypeEnum.Grid: { StackLayout.Children.Clear(); LayoutGrid control = new LayoutGrid(); StackLayout.Children.Add(control); } break; case LayoutTypeEnum.GridRight: { StackLayout.Children.Clear(); LayoutGridRight control = new LayoutGridRight(); StackLayout.Children.Add(control); } break; } }
public StimulReporDesigner_Frame(string reportUn) { #region Настраиваем дизайнер StimulReportFactory.PrepareDesigner(); StiHelper.HyperLinkAttach(); //StiHelper.StiWcfConfigure(); InitializeComponent(); DateRangeMode = enumDateRangeMode.WithoutDateMode; TreeMode = enumTreeMode.None; // Designer StiOptions.WCFService.WCFRenderReport += WCFRenderReport; StiOptions.WCFService.WCFTestConnection += WCFTestConnection; StiOptions.WCFService.WCFBuildObjects += WCFBuildObjects; //StiOptions.WCFService.WCFRetrieveColumns += WCFRetrieveColumns; StiOptions.WCFService.WCFOpeningReportInDesigner += WCFOpeningReportInDesigner; //Designer. StiOptions.WCFService.WCFRequestFromUserRenderReport += WCFRequestFromUserRenderReport; StiOptions.Engine.GlobalEvents.SavingReportInDesigner += GlobalEvents_SavingReportInDesigner; //StiOptions.Viewer.Elements.ShowReportSaveToServerButton = true; //Stimulsoft.Report.StiOptions.Viewer.Elements.ShowReportSaveToServerButton = true; // Interactions StiOptions.WCFService.WCFRenderingInteractions += WCFRenderingInteractions; // Prepare RequestFromUser Variables StiOptions.WCFService.WCFPrepareRequestFromUserVariables += WCFPrepareRequestFromUserVariables; StiOptions.WCFService.WCFInteractiveDataBandSelection += WCFInteractiveDataBandSelection; #endregion _reportUn = reportUn; //Загрузка отчета из БД LayoutGrid.RunBackgroundAsync <TReportInfo>("LoadReport", response => { if (response == null || response.Data == null) { return; } var report = new StiReport { CacheAllData = true, ReportCacheMode = StiReportCacheMode.On, }; try { report.Load(response.Data.DecodeBuffer()); } catch (Exception ex) { Manager.UI.ShowMessage(ex.Message); } _reportUn = response.ReportUn; _reportName = tbReportName.Text = response.StringName; StimulReportFactory.PrepareReport(report, !string.IsNullOrEmpty(reportUn)); ProryvReportFunctions.RegisterFunctionsInReport(); DesignerControl.Report = report; DateRangeMode = (enumDateRangeMode)response.DateRangeMode; TreeMode = (enumTreeMode)response.TreeMode; CheckBoxChannels.IsChecked = response.IsShowChannelSelector; }, EnumServiceType.StimulReport, reportUn); }