public EditorTabControl() { InitializeComponent(); this.SuspendLayout(); Dictionary <string, Type> mappings = ImplementedViews.GetElementMappings(); int pageIndex = 0; foreach (KeyValuePair <string, Type> mapping in mappings) { UserControl view = ImplementedViews.GetView(mapping.Value) as UserControl; if (view == null) { continue; } tabControl.TabPages.Add(mapping.Key); view.Dock = DockStyle.Fill; tabControl.TabPages[pageIndex++].Controls.Add(view); } this.ResumeLayout(); foreach (TabPage page in tabControl.TabPages) { if (page.Controls.Count == 0) { continue; } IPageView view = (IPageView)page.Controls[0]; view.OnError += new EventHandler <PageViewErrorArgs>(OnPageError); view.OnUpdate += new EventHandler <ExportStatusChangedArgs>(OnViewUpdate); } tabControl.TabIndexChanged += new EventHandler(OnTabIndexChanged); }
/// <summary> /// Create Guide. if position > max, create failed. /// </summary> private bool CreateGuide(Orientation orient, int x, int y) { if (orient == Orientation.Vertical) { if (x > CommonDefine.MaxEditorWidth) { return(false); } } else { if (y > CommonDefine.MaxEditorHeight) { return(false); } } if (_isGlobalChecked) { IGuide guide = _document.CreateGlobalGuide(orient, x, y); _guideList.Add(guide); } else { IPageView pageView = _page.PageViews.GetPageView(SelectionService.GetCurrentPage().CurAdaptiveViewGID); if (pageView != null) { IGuide guide = pageView.CreateGuide(orient, x, y); _guideList.Add(guide); } } return(true); }
public bool ChangeCurrentStyle(Guid newStyleGid) { if (newStyleGid == Guid.Empty) { _style = _master.MasterStyle; } else { _style = _master.GetMasterStyle(newStyleGid); if (_style == null) { _style = _master.MasterStyle; } } IPageView view = _master.MasterPage.PageViews.GetPageView(newStyleGid); if (view == null || _items == null) { return(false); } foreach (var item in _items) { item.ChangeCurrentPageView(view); } return(true); }
public void LoadAllChildrenWidgets() { if (_items == null) { _items = new ObservableCollection <WidgetPreViewModeBase>(); } _items.Clear(); _hamburgerVM.Widget.MenuPage.Open(); Guid viewID = _pageEditorViewModel.CurAdaptiveViewGID; IPageView view = _hamburgerVM.Widget.MenuPage.PageViews.GetPageView(viewID); if (view == null) { return; } foreach (IWidget wdg in _hamburgerVM.Widget.MenuPage.Widgets) { WidgetPreViewModeBase preItem = ReadOnlyWidgetFactory.CreateWidget(wdg, false); if (preItem == null) { continue; } preItem.ChangeCurrentPageView(view); _items.Add(preItem); } }
public HistoryItem(IPageView view, Type viewType, object parameter) { this.View = view; this.ViewType = viewType; this.Parameter = parameter; this.State = new Dictionary <string, object>(); }
public void Redo() { // Add the group to document _pageVM.PageEditorModel.AddClonedGroup2Dom(_group); // Add child widgetVM foreach (WidgetViewModBase widgetVM in _childWidgetVMs) { _pageVM.AddWidgetItem(widgetVM); List <Guid> placedPageViewGuids = _placedPageViewGuidsMap[widgetVM.WidgetID]; foreach (Guid guid in placedPageViewGuids) { IPageView pageView = _pageVM.PageEditorModel.PageViews[guid]; if (pageView != null) { pageView.PlaceWidget(widgetVM.WidgetModel.WdgDom.Guid); } } } // Create new GroupViewModel with same group _pageVM.CreateGroupRender(_group); }
public void LoadAllChildrenWidgets(bool bIsNail) { if (items == null) { items = new ObservableCollection <WidgetPreViewModeBase>(); } items.Clear(); if (!_page.IsOpened) { _page.Open(); } IPageView view = _page.PageViews.GetPageView(_styleGuid); if (view == null) { _page.Close(); return; } foreach (IWidget wdg in _page.Widgets) { WidgetPreViewModeBase preItem = ReadOnlyWidgetFactory.CreateWidget(wdg, bIsNail); preItem.ChangeCurrentPageView(view); if (preItem == null) { continue; } items.Add(preItem); } //_page.Close(); }
public void LoadAllChildrenWidgets() { if (_items == null) { _items = new ObservableCollection <WidgetPreViewModeBase>(); } _items.Clear(); _master.MasterPage.Open(); IPageView view = _master.MasterPage.PageViews.GetPageView(StyleGID); if (view == null) { return; } foreach (IWidget wdg in _master.MasterPage.Widgets) { WidgetPreViewModeBase preItem = ReadOnlyWidgetFactory.CreateWidget(wdg, _IsNail); preItem.ChangeCurrentPageView(view); if (preItem == null) { continue; } _items.Add(preItem); } }
private void CreateGuides() { _guideList = new List <IGuide>(); if (ColumnsCount > 0) { CreateVerticalGuides(); } if (RowsCount > 0) { CreateHorizontalGuides(); } if (_isGlobalChecked) { CreateGlobalGuideCommand cmd = new CreateGlobalGuideCommand(_document, _guideList); CurrentUndoManager.Push(cmd); } else { IPageView pageView = _page.PageViews.GetPageView(SelectionService.GetCurrentPage().CurAdaptiveViewGID); if (pageView == null) { pageView = _page.PageViews.GetPageView(_document.AdaptiveViewSet.Base.Guid); } if (pageView == null) { return; } CreatePageGuideCommand cmd = new CreatePageGuideCommand(pageView, _guideList); CurrentUndoManager.Push(cmd); } }
public JsWidgetStyle(JsWidget parentJsWidget, IWidgetStyle widgetStyle, IPageView pageView, bool bIsSetMD5) { _parentJsWidget = parentJsWidget; _widgetStyle = widgetStyle; _pageView = pageView; IsSetMD5 = bIsSetMD5; }
public void ExportChanges(XmlWriter writer) { StringBuilder sb = new StringBuilder(); foreach (TabPage page in tabControl.TabPages) { IPageView view = (IPageView)page.Controls[0]; string xml = view.ExportChanges(); if (!String.IsNullOrEmpty(xml)) { sb.Append(xml); sb.Append("\r\n"); } } try { XDocument doc = XDocument.Parse(String.Format(envelopeFormat, sb.ToString())); doc.WriteTo(writer); writer.Flush(); } catch (Exception ex) { MessageBox.Show(ex.Message, Settings.Default.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void Show <T>(IPageView pageView) where T : Window { var x = (IWindowPageView)Get <T>().Instance; x.Show(); x.ShowPage(pageView); }
private void UpdatePageView(Guid viewGuid) { IPageViews allViews = _model.PageViews; if (allViews == null) { return; } IPageView targetView = allViews.GetPageView(viewGuid); if (targetView == null) { return; } _selectionService.RemoveAllWidgets(); DeselectAll(); //first,update the widget common style property foreach (WidgetViewModBase it in Items.Where(c => c.IsGroup == false)) { it.ChangeCurrentPageView(targetView); } //then,update the group common style property foreach (WidgetViewModBase it in Items.Where(c => c.IsGroup == true)) { it.ChangeCurrentPageView(targetView); } _ListEventAggregator.GetEvent <UpdateAdaptiveView>().Publish(viewGuid); }
override public void ChangeCurrentPageView(IPageView targetPageView) { if (_model == null || targetPageView == null) { return; } //if (targetPageView.Guid == GetCurrentPageViewGID()) //{ // return ; //} if (true == targetPageView.Widgets.Contains(_model.Guid)) { IsShowInPageView2Adaptive = true; } else { IsShowInPageView2Adaptive = false; } bool bRes = _model.ChangeCurrentStyle(targetPageView.Guid); if (bRes == true) { UpdateWidgetStyle2UI(); } }
private void CreateInnerImageObjs(IPage ChildPage, IDocument document) { if (ChildPage == null) { return; } //initialize the style property with base-adaptive Guid BaseViewID = document.AdaptiveViewSet.Base.Guid; IPageView pageView = ChildPage.PageViews.GetPageView(BaseViewID); if (_currentItems != null) { _currentItems.Clear(); } else { _currentItems = new List <WidgetPreViewModeBase>(); } if (document.GeneratorConfigurationSet.DefaultHtmlConfiguration.ExportType == ExportType.ImageFile) { List <IRegion> objs = GetAllObjects(ChildPage); foreach (IRegion wdg in objs) { if (wdg is IShape || wdg is ILine) { WidgetPreViewModeBase preItem = ReadOnlyWidgetFactory.CreateWidget(wdg, true); if (preItem == null) { continue; } preItem.ChangeCurrentPageView(pageView); preItem.IsHiddenInvalid = true; _currentItems.Add(preItem); } } } else { List <IRegion> objs = GetAllObjects(ChildPage); foreach (IRegion wdg in objs) { if (wdg is ILine) { WidgetPreViewModeBase preItem = ReadOnlyWidgetFactory.CreateWidget(wdg, true); if (preItem == null) { continue; } preItem.ChangeCurrentPageView(pageView); preItem.IsHiddenInvalid = true; _currentItems.Add(preItem); } } } Debug.WriteLine("--- Exit CreateImageObjs() ---"); }
public static PageContent Create(IPageView pageContainer) { if (MainController.Instance.WallbinViews.FormatState.ListView) return new ListPageContent(pageContainer); if (MainController.Instance.WallbinViews.FormatState.AccordionView) return new AccordionPageContent(pageContainer); return new ColumnsPageContent(pageContainer); }
public JsMasterStyle(IMaster master, IMasterStyle masterStyle, IPageView pageView, bool bIsSetMD5, Guid AdaptiviewID) { _master = master; _masterStyle = masterStyle; _pageView = pageView; IsSetMD5 = bIsSetMD5; _childPageView = _master.MasterPage.PageViews[AdaptiviewID]; }
public void BeginResize() { foreach (TabPage page in tabControl.TabPages) { IPageView view = (IPageView)page.Controls[0]; view.BeginResize(); } }
/// <summary> /// Destroy the window created in IPropertyPage::Activate. /// </summary> public void Deactivate() { if (myPageView != null) { myPageView.Dispose(); myPageView = null; } }
/// <summary> /// Destroy the window created in IPropertyPage::Activate. /// </summary> public void Deactivate() { if (this.myPageView != null) { this.myPageView.Dispose(); this.myPageView = null; } }
public PageContent(IPageView pageContainer) { InitializeComponent(); PageContainer = pageContainer; _scrooTimer.Stop(); _scrooTimer.Interval = 5; _scrooTimer.Tick += OnScrooTimerTick; }
private async Task AsyncLoadWidgets(Guid pGID) { //Async operation to create all widget VM object for efficiency _pageGID = pGID; IDocumentService doc = ServiceLocator.Current.GetInstance <IDocumentService>(); await Task.Factory.StartNew(() => CreateAllObjs(doc.Document)); //initialize the style property with base-adaptive IPage CurrentPage = doc.Document.Pages.GetPage(pGID); if (CurrentPage == null) { return; } Guid BaseViewID = doc.Document.AdaptiveViewSet.Base.Guid; IPageView pageView = CurrentPage.PageViews.GetPageView(BaseViewID); //Async operation to load single widget to canvas and update layout foreach (WidgetPreViewModeBase wdg in _currentItems) { if (_waitingPageGID != Guid.Empty || _currentPageGID == Guid.Empty || _htmlService.IsHtmlGenerating == true) { break; } wdg.ChangeCurrentPageView(pageView); //Sync loading Debug.WriteLine("----->Preview----->Add Widget 2 Canvas:" + wdg.WidgetID); items.Add(wdg); //Async loading //PreCanvas.Dispatcher.Invoke(DispatcherPriority.Input, (Action)(() => //{ // Debug.WriteLine("----->Preview----->Add Widget 2 Canvas:" + wdg.WidgetID); // items.Add(wdg); //})); } lock (this) { if (_waitingPageGID != Guid.Empty) { _currentPageGID = _waitingPageGID; _waitingPageGID = Guid.Empty; Debug.WriteLine("----->Preview----->Second Page:" + _currentPageGID.ToString()); } else { _currentPageGID = Guid.Empty; _waitingPageGID = Guid.Empty; } } Debug.WriteLine("----->Preview----->AsyncLoadWidgets is Done"); }
public override string ToString() { //this is just for debug test, delete it later if (_master.ParentPage is IDocumentPage) { // System.Diagnostics.Debug.WriteLine("====Master md5:" + _master.MD5 + " ==========================="); } StringBuilder builder = new StringBuilder(); builder.Append("{"); builder.AppendFormat("\"id\":\"{0}\",", _master.Guid.ToString()); if (IsSetMD5 == true) { builder.AppendFormat("\"MD5\":\"{0}\",", _master.MD5); } builder.AppendFormat("\"masterPageID\":\"{0}\",", _master.MasterPageGuid.ToString()); if (_master.ParentGroup != null) { builder.AppendFormat("\"parentGroupID\":\"{0}\",", _master.ParentGroup.Guid.ToString()); } builder.Append("\"style\":"); IPageView basePageView = _master.ParentPage.PageViews[_master.ParentDocument.AdaptiveViewSet.Base.Guid]; JsMasterStyle masterStyle = new JsMasterStyle(_master, _master.MasterStyle, basePageView, IsSetMD5, _master.ParentDocument.AdaptiveViewSet.Base.Guid); builder.Append(masterStyle.ToString()); builder.Append(","); builder.Append("\"adaptiveViewStyles\":["); foreach (IAdaptiveView view in _master.ParentDocument.AdaptiveViewSet.AdaptiveViews) { IMasterStyle masterViewStyle = _master.GetMasterStyle(view.Guid); IPageView pageView = _master.ParentPage.PageViews[view.Guid]; if (masterViewStyle != null && pageView != null) { masterStyle = new JsMasterStyle(_master, masterViewStyle, pageView, IsSetMD5, view.Guid); builder.Append(masterStyle.ToString()); builder.Append(","); } } JsHelper.RemoveLastComma(builder); builder.Append("]"); builder.Append("}"); return(builder.ToString()); }
public override IRegions GetChildRegions(Guid viewGuid) { if (MasterPage != null) { IPageView pageView = MasterPage.PageViews[viewGuid]; if (pageView != null) { return(pageView.GetChildRegions(viewGuid)); } } return(new Regions()); }
private void OnViewUpdate(object sender, ExportStatusChangedArgs args) { IPageView view = (IPageView)sender; TabPage currTab = tabControl.SelectedTab; IPageView currView = (IPageView)currTab.Controls[0]; if (view.Equals(currView) && _readyForExport != args.IsReadyForExport) { _readyForExport = args.IsReadyForExport; if (OnExportStatusChanged != null) { OnExportStatusChanged(this, args); } } }
public void Undo() { _pageVM.AddWidgetItem(_widgetVM); _widgetVM.IsSelected = true; foreach (Guid guid in _placedPageViewGuids) { IPageView pageView = _pageVM.PageEditorModel.PageViews[guid]; if (pageView != null) { pageView.PlaceWidget(_widgetVM.WidgetModel.WdgDom.Guid); } } }
protected override void RunInternal() { // Load library 1. string libraryFileName1 = Path.Combine(Program.WORKING_DIRECTORY, "Test_CreateLibraryInPage.libpn"); ILibrary library1 = Program.Service.LibraryManager.LoadLibrary(libraryFileName1); // Create a new document. Program.Service.NewDocument(DocumentType.Standard); IDocument document = Program.Service.Document; // Add libraries in library1 into the new page 1. IDocumentPage page1 = document.CreatePage("Page 1"); ITreeNode node1 = document.DocumentSettings.LayoutSetting.PageTree.AddChild(TreeNodeType.Page); node1.AttachedObject = page1; page1.Open(); // Get the page view for base adaptive view. IPageView baseView1 = page1.PageViews[document.AdaptiveViewSet.Base.Guid]; // Enumerate custom objects in the library1, you also can get custom object with the custom object guid // if you cache the guids in other place. foreach (ICustomObject customObject in library1.CustomObjects) { baseView1.AddCustomObject(customObject, 0, 0); } foreach (ICustomObject customObject in library1.CustomObjects) { baseView1.AddCustomObject(customObject, 200, 200); // 200 x 200 is the new base location of the custom object. } // Close the page. page1.Close(); // Save the document. string fileName = Path.Combine(Program.WORKING_DIRECTORY, _caseName + ".pn"); Program.Service.Save(fileName); // Close the document. Program.Service.Close(); // You can delete/remove/unloaded libraries explicitly from DocumentService if you don't want it. Program.Service.LibraryManager.DeleteLibrary(library1.Guid); }
public void ShowPage(IPageView pageView) { PahkatApp.Current.Dispatcher.Invoke(() => { ShowContent(); FrmContainer.Navigate(pageView); _currentPage = pageView; JournalEntry page; while ((page = FrmContainer.RemoveBackEntry()) != null) { // page. Log.Verbose("Murdered a view. {page}", page); // Clean up everything } }); }
public void OpenPage() { if (_page != null) { _page.Open(); // Refetch active view if (_activeView != null) { _activeView = _page.PageViews.GetPageView(_activeView.Guid); } else { Guid ViewId = _document.AdaptiveViewSet.Base.Guid; _activeView = _page.PageViews.GetPageView(ViewId); } } }
public void Correctly_builds_page_html() { MockRepository mocks = new MockRepository(); IApplicationListingBodyView bodyView = mocks.CreateMock <IApplicationListingBodyView>(); IPageView pageView = mocks.CreateMock <IPageView>(); IWebContext webContext = mocks.CreateMock <IWebContext>(); using (mocks.Record()) { Expect.Call(bodyView.BuildHtml()).Return("some body html"); Expect.Call(pageView.BuildHtml("some body html")).Return("the page html"); webContext.WriteToResponse("the page html"); } using (mocks.Playback()) { IApplicationListingView view = new ApplicationListingView(bodyView, pageView, webContext); view.Render(); } }
public void Correctly_builds_error_page_html() { MockRepository mocks = new MockRepository(); ILoadBalancerBodyView bodyView = mocks.CreateMock <ILoadBalancerBodyView>(); IPageView pageView = mocks.CreateMock <IPageView>(); IWebContext webContext = mocks.CreateMock <IWebContext>(); using (mocks.Record()) { Expect.Call(bodyView.BuildHtml("error message")).Return("some body html"); Expect.Call(pageView.BuildHtml("some body html")).Return("the page html"); webContext.WriteToResponse("the page html"); } using (mocks.Playback()) { ILoadBalancerView view = new LoadBalancerView(bodyView, pageView, webContext); view.Render("error message"); } }
override public bool ChangeCurrentStyle(Guid newStyleGid) { if (base.ChangeCurrentStyle(newStyleGid) == false) { return(false); } _toast.ToastPage.Open(); IPageView view = _toast.ToastPage.PageViews.GetPageView(newStyleGid); if (view == null || _items == null) { return(false); } foreach (var item in _items) { item.ChangeCurrentPageView(view); } return(true); }
/// <summary> /// Destroy the window created in IPropertyPage::Activate. /// </summary> public void Deactivate() { if (this.myPageView != null) { this.myPageView.Dispose(); this.myPageView = null; } }
protected PageContent(IPageView pageContainer) { InitializeComponent(); PageContainer = pageContainer; Resize += OnResize; }
public ListPageContent(IPageView pageContainer) : base(pageContainer) { }
public virtual void SelectPage(IPageView pageView) { throw new NotImplementedException(); }
protected void SetActivePage(IPageView pageView) { PageChanging?.Invoke(this, EventArgs.Empty); ActivePage = pageView; if (ActivePage == null) return; ActivePage.LoadPage(); MainController.Instance.Settings.SelectedPage = ActivePage.Page.Name; MainController.Instance.Settings.Save(); PageChanged?.Invoke(this, EventArgs.Empty); }
public override void SelectPage(IPageView pageView) { _pageSelector.EditValue = pageView; }
public ColumnsPageContent(IPageView pageContainer) : base(pageContainer) { }
public AccordionPageContent(IPageView pageContainer) : base(pageContainer) { }
public LoadBalancerView(ILoadBalancerBodyView bodyView, IPageView pageView, IWebContext context) { _bodyView = bodyView; _pageView = pageView; _context = context; }
public override void SelectPage(IPageView pageView) { xtraTabControl.SelectedTabPage = (XtraTabPage)pageView; }
public ApplicationListingView(IApplicationListingBodyView bodyView, IPageView pageView, IWebContext webContext) { this.bodyView = bodyView; this.pageView = pageView; this.webContext = webContext; }