public MainWindowViewModel() { _pokeService = new PokeInformationService(); _printingService = new PrintingService(); SearchPokemon = new AwaitableDelegateCommand(SearchPokemonAsync); SortByTypeCommand = new AwaitableDelegateCommand(SortByType); PrintSelectedPokemonCommand = new AwaitableDelegateCommand(PrintSelectedPokemon); _ = PrintAllPokemonAsync(); }
private void InitializeSfDiagram() { //Initializing PrintingService for DiagramViewModel PrintingService = new PrintingService(); //to display page number at top of the print preview. PrintingService.PrintSettings.PageHeaderHeight = 50; PrintingService.PrintSettings.PageHeaderTemplate = App.Current.Resources["PrintHeaderTemplate"] as DataTemplate; }
private void BtnPrint_OnClick(object sender, RoutedEventArgs e) { if (comboBoxShopsToolsIssued.SelectedIndex < 1) { return; } var shop = (Shop)comboBoxShopsToolsIssued.SelectedItem; PrintingService.PrintToolsIssued(shop); }
public DiagramVM() { PrintingService = new PrintingService(); //Custom command to execute export action LoadCommand = new Command(OnLoadCommand); SaveCommand = new Command(OnSaveCommand); ExportCommand = new Command(OnExported); PrintClickCommand = new Command(OnPrintCommand); DropCommand = new Command(OnItemDropped); ItemAddedCommand = new Command(OnItemAdded); }
private void PrintButton_Click(object sender, EventArgs e) { var result = SaveFileDialog.ShowDialog(this); if (result == DialogResult.OK || result == DialogResult.Yes) { var service = new PrintingService(); var fileName = SaveFileDialog.FileName; service.Print(fileName, programData); MessageBox.Show($"{fileName} has been created."); } }
public DiagramVM(StorageFile file, bool isValidXml) { _isValidXml = isValidXml; _file = file; Nodes = new ObservableCollection <NodeVM>(); Connectors = new ObservableCollection <ConnectorVM>(); Groups = new ObservableCollection <GroupVM>(); SelectedItems = new SelectorVM(this); Select = new Command(param => IsSelected = true); FirstLoad = new Command(OnViewLoaded); SnapSettings = new SnapSettings() { SnapConstraints = SnapConstraints.All, SnapToObject = SnapToObject.All }; PageSettings = new PageVM(); (PageSettings as PageVM).InitDiagram(this); this.HorizontalRuler = new Ruler() { Orientation = Orientation.Horizontal }; this.VerticalRuler = new Ruler() { Orientation = Orientation.Vertical }; //OffPageBackground = new SolidColorBrush(new Color() { A = 0xFF, R = 0xEC, G = 0xEC, B = 0xEC }); //OffPageBackground = new SolidColorBrush(new Color() { A = 0xFF, R = 0x2D, G = 0x2D, B = 0x2D }); InitLocation(); #if SyncfusionFramework4_5_1 ExportSettings = new ExportSettings() { ImageStretch = Stretch.Uniform, ExportMode = ExportMode.PageSettings }; PrintingService = new PrintingService(); #endif Export = new Command(OnExportCommand); Captures = new Command(OnCapturesCommand); ClearDiagram = new Command(OnClearCommand); Upload = new Command(Onuploadcommand); Draw = new Command(OnDrawCommand); SingleSelect = new Command(OnSingleSelectCommand); SelectAll = new Command(OnSelectAllCommand); Manipulate = new Command(OnManipulateCommand); Port = new Command(OnPortCommand); Diagrams = new ObservableCollection <DiagramVM>(); }
private void DaySumMenuItemOperation() { try { if (!$"Εκτύπωση συνόλου για ημέρα {DateTime.Now.ToString("dd/MM/yyyy")}. Συνέχεια?".SimpleQMsg()) { return; } var todayAmount = OrderingService.GetTodaysSum(); PrintingService.DaySummary(todayAmount); } catch (Exception x) { x.ShowException(); } }
private void PrintOrderOperation() { try { if (!@"Η παραγγελία θα εκτυπωθεί. Συνέχεια?".SimpleQMsg(@"Προσοχή")) { return; } var tblId = showTableLbl.Text.ToInt(); var tableOrder = OrderingService.GetTableOrder(tblId); if (tableOrder != null) { PrintingService.ReceiptForOrder(tableOrder); } } catch (Exception x) { x.ShowException(); } }
public CustomDiagramPrintManager(PrintingService printingService, PrintViewModel diagram) : base(printingService) { _diagram = diagram; }
/// <summary> /// This constructor is used for launching as a CXP capability. /// </summary> public ViewerForm() { Application.EnableVisualStyles(); //Application.DoEvents(); //Note: this seems to cause problems in the CXP Capability context. #if DEBUG && LOGGING LoggingService logger = new LoggingService(); #endif PresenterModel model = new PresenterModel(); m_Loader = new DefaultDeckMarshalService(); this.SuspendLayout(); this.m_EventQueue = new ControlEventQueue(this); this.m_Model = model; this.m_Marshal = m_Loader; UpdateTitle(); this.Name = "ViewerForm"; //Retrieve the icon System.Reflection.Assembly thisExe = System.Reflection.Assembly.GetExecutingAssembly(); this.Icon = new Icon(thisExe.GetManifestResourceStream("UW.ClassroomPresenter.Presenter.ico")); // The form should fill 5/6 of the screen by default. // FIXME: Load/Store previous window size from/in the registry. this.Size = new Size(SystemInformation.WorkingArea.Size.Width * 5 / 6, SystemInformation.WorkingArea.Size.Height * 5 / 6); // the form should be no smaller than 1/2 it's original size this.MinimumSize = new Size(this.Size.Width / 2, this.Size.Height / 2); Menus.FileMenu.CloseFormDelegate cfd = new UW.ClassroomPresenter.Viewer.Menus.FileMenu.CloseFormDelegate(this.Close); this.Menu = new Menus.ViewerMainMenu(this.m_EventQueue, this.m_Model, m_Loader, cfd); this.m_MainToolBars = new MainToolBars(this.m_Model, this.m_EventQueue); this.m_PresentationLayout = new ViewerPresentationLayout(this.m_Model); //this.m_MainToolBar.Dock = DockStyle.Top; this.m_PresentationLayout.Dock = DockStyle.Fill; this.Controls.Add(this.m_PresentationLayout); this.Controls.Add(this.m_MainToolBars.m_MainToolBar); this.Controls.Add(this.m_MainToolBars.m_MainClassmateToolBar); this.Controls.Add(this.m_MainToolBars.m_ExtraClassmateToolBar); this.ResumeLayout(false); this.KeyDown += new KeyEventHandler(this.OnKeyDown); this.KeyPreview = true; ///add listeners for HumanName, Role, Stylus properties role_listener_ = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.ParticipantRoleChanged)); stylus_listener_ = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.StylusChanged)); instructor_listener_ = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.InstructorChanged)); this.m_Model.Participant.Changed["Role"].Add(role_listener_.Dispatcher); this.m_Model.Changed["Stylus"].Add(stylus_listener_.Dispatcher); this.m_Model.Network.Changed["Association"].Add(instructor_listener_.Dispatcher); //Add listener for the version exchange warning pop-up this.m_VersionExchangePopUpListener = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.PopUpWarningHandler)); this.m_Model.VersionExchange.Changed["PopUpWarningMessage"].Add(m_VersionExchangePopUpListener.Dispatcher); //Add listener for NetworkStatus m_NetworkStatusListener = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.NetworkStatusChanged)); this.m_Model.Network.Changed["NetworkStatus"].Add(m_NetworkStatusListener.Dispatcher); this.m_FullScreenAdapter = new FullScreenAdapter(this.m_Model, this.m_PresentationLayout); instructor_listener_.Dispatcher(this, null); role_listener_.Dispatcher(this, null); stylus_listener_.Dispatcher(this, null); this.FormClosing += this.SaveClose; //Store local DPI settings which are used to make sure ink is scaled correctly. using (Graphics g = this.CreateGraphics()) { ViewerStateModel.SetLocalDpi(g.DpiX, g.DpiY); } m_ViewerState = new ViewerStateService(model.ViewerState); m_Registry = new RegistryService(model.ViewerState); #if DEBUG && LOGGING logger.AttachToModel(model.ViewerState); #endif PrintingService printing = new PrintingService(model.ViewerState); m_Undo = new WorkspaceUndoService(this.m_EventQueue, model); m_Association = new NetworkAssociationService(this.m_EventQueue, model); m_DeckMatcher = new DeckMatcherService(this.m_EventQueue, model); }
//Method to execute Print action private void OnPrintCommand(object obj) { PrintingService.ShowDialog = true; PrintingService.Print(); }
//StorageFile file, public DiagramVM(string file, bool isValidXml) { _isValidXml = isValidXml; _file = file; Nodes = new ObservableCollection <NodeVM>(); Connectors = new ObservableCollection <ConnectorVM>(); Groups = new ObservableCollection <GroupVM>(); SelectedItems = new SelectorVM(this); PortVisibility = PortVisibility.MouseOverOnConnect; Select = new Command(param => IsSelected = true); FirstLoad = new Command(OnViewLoaded); HistoryManager = new customManager(); SnapSettings = new SnapSettings() { SnapConstraints = SnapConstraints.All, SnapToObject = SnapToObject.All }; PreviewSettings = new PreviewSettings() { PreviewMode = PreviewMode.Preview }; PageSettings = new PageVM(); (PageSettings as PageVM).InitDiagram(this); this.HorizontalRuler = new Ruler() { Orientation = Orientation.Horizontal }; this.VerticalRuler = new Ruler() { Orientation = Orientation.Vertical }; //OffPageBackground = new SolidColorBrush(new Color() { A = 0xFF, R = 0xEC, G = 0xEC, B = 0xEC }); //OffPageBackground = new SolidColorBrush(new Color() { A = 0xFF, R = 0x2D, G = 0x2D, B = 0x2D }); InitLocation(); PrintingService = new PrintingService(); ExportSettings = new ExportSettings() { ImageStretch = Stretch.Uniform, ExportMode = ExportMode.PageSettings }; #if SyncfusionFramework4_5_1 ExportSettings = new ExportSettings() { ImageStretch = Stretch.Uniform, ExportMode = ExportMode.PageSettings }; PrintingService = new PrintingService(); #endif FlipCommand = new Command(OnFlipCommand); ExportCommand = new Command(OnExportCommand); PrintCommand = new Command(OnPrintCommand); Captures = new Command(OnCapturesCommand); ClearDiagram = new Command(OnClearCommand); Upload = new Command(Onuploadcommand); Draw = new Command(OnDrawCommand); SingleSelect = new Command(OnSingleSelectCommand); SelectAll = new Command(OnSelectAllCommand); Manipulate = new Command(OnManipulateCommand); LoadExt = new Command(OnLoadExt); AddImageNode = new Command(OnAddImageNodeCommand); PageOrientationCommand = new Command(OnPageOrientationCommand); PageSizeCommand = new Command(OnPageSizeCommand); ConnectTypeCommand = new Command(OnConnectTypeCommand); RotateTextCommand = new Command(OnRotateTextCommand); //SelectTextCommand = new Command(OnSelectTextCommand); SizeandPositionCommand = new Command(OnSizeandPositionCommand); PanZoomCommand = new Command(OnPanZoomCommand); FitToWidthCommand = new Command(OnFitToWidthCommand); FitToPageCommand = new Command(OnFitToPageCommand); //Tool = Tool.ZoomPan | Tool.SingleSelect; ; //ConnectorVM c = new ConnectorVM() //{ // SourcePoint = new Point(100, 100), // TargetPoint = new Point(300, 300) //}; //(this.ConnectorCollection as ICollection<ConnectorVM>).Add(c); }
/// <summary> /// This constructor is used for launching as a CXP capability. /// </summary> public ViewerForm() { Application.EnableVisualStyles(); //Application.DoEvents(); //Note: this seems to cause problems in the CXP Capability context. #if DEBUG && LOGGING LoggingService logger = new LoggingService(); #endif PresenterModel model = new PresenterModel(); m_Loader = new DefaultDeckMarshalService(); this.SuspendLayout(); this.m_EventQueue = new ControlEventQueue(this); this.m_Model = model; this.m_Marshal = m_Loader; UpdateTitle(); this.Name = "ViewerForm"; //Retrieve the icon System.Reflection.Assembly thisExe = System.Reflection.Assembly.GetExecutingAssembly(); this.Icon = new Icon(thisExe.GetManifestResourceStream("UW.ClassroomPresenter.Presenter.ico")); this.StartPosition = FormStartPosition.Manual; this.loadRegSettings(); this.MinimumSize = new Size(440, 330); Menus.FileMenu.CloseFormDelegate cfd = new UW.ClassroomPresenter.Viewer.Menus.FileMenu.CloseFormDelegate(this.Close); this.Menu = new Menus.ViewerMainMenu(this.m_EventQueue, this.m_Model, m_Loader, cfd); this.m_MainToolBars = new MainToolBars(this.m_Model, this.m_EventQueue); this.m_PresentationLayout = new ViewerPresentationLayout(this.m_Model); //this.m_MainToolBar.Dock = DockStyle.Top; this.m_PresentationLayout.Dock = DockStyle.Fill; this.Controls.Add(this.m_PresentationLayout); // Hack: toggle the second monitor to make it scale correctly when using Surface Pro 3. // Bounds need to be set after the ViewerPresentationLayout control is added, // Otherwise DPI scaling appears to be done incorrectly. This issue so far // appears to be unique to the Surface Pro 3. using (Synchronizer.Lock(model.ViewerState.SyncRoot)) { if (model.ViewerState.SecondMonitorEnabled) { model.ViewerState.SecondMonitorEnabled = false; model.ViewerState.SecondMonitorEnabled = true; } } this.Controls.Add(this.m_MainToolBars.m_MainToolBar); this.Controls.Add(this.m_MainToolBars.m_MainClassmateToolBar); this.Controls.Add(this.m_MainToolBars.m_ExtraClassmateToolBar); this.ResumeLayout(false); this.KeyDown += new KeyEventHandler(this.OnKeyDown); this.KeyPreview = true; ///add listeners for HumanName, Role, Stylus properties role_listener_ = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.ParticipantRoleChanged)); stylus_listener_ = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.StylusChanged)); instructor_listener_ = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.InstructorChanged)); this.m_Model.Participant.Changed["Role"].Add(role_listener_.Dispatcher); this.m_Model.Changed["Stylus"].Add(stylus_listener_.Dispatcher); this.m_Model.Network.Changed["Association"].Add(instructor_listener_.Dispatcher); //Add listener for the version exchange warning pop-up this.m_VersionExchangePopUpListener = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.PopUpWarningHandler)); this.m_Model.VersionExchange.Changed["PopUpWarningMessage"].Add(m_VersionExchangePopUpListener.Dispatcher); //Add listener for NetworkStatus m_NetworkStatusListener = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.NetworkStatusChanged)); this.m_Model.Network.Changed["NetworkStatus"].Add(m_NetworkStatusListener.Dispatcher); this.m_FullScreenAdapter = new FullScreenAdapter(this.m_Model, this.m_PresentationLayout); instructor_listener_.Dispatcher(this, null); role_listener_.Dispatcher(this, null); stylus_listener_.Dispatcher(this, null); this.FormClosing += this.SaveClose; //Store local DPI settings which are used to make sure ink is scaled correctly. using (Graphics g = this.CreateGraphics()) { ViewerStateModel.SetLocalDpi(g.DpiX, g.DpiY); } m_ViewerState = new ViewerStateService(model.ViewerState); m_Registry = new RegistryService(model.ViewerState); #if DEBUG && LOGGING logger.AttachToModel(model.ViewerState); #endif PrintingService printing = new PrintingService(model.ViewerState); m_Undo = new WorkspaceUndoService(this.m_EventQueue, model); m_Association = new NetworkAssociationService(this.m_EventQueue, model); m_DeckMatcher = new DeckMatcherService(this.m_EventQueue, model); }
public CustomDiagramPrintManager(PrintingService printingService, DiagramVM diagram) : base(printingService) { _diagram = diagram; }
public static void ViewerThreadStart(List <string> inputFiles, bool standalone) { Trace.WriteLine("ViewerThreadStart starting"); Application.EnableVisualStyles(); Application.DoEvents(); Process p = Process.GetCurrentProcess(); SetProcessWorkingSetSize(p.Handle, -1, -1); #if WEBSERVER // Create the web service Web.WebService web_server = new Web.WebService(null, "9090"); #endif #if DEBUG && LOGGING LoggingService logger = new LoggingService(); #endif Trace.WriteLine("Make PresenterModel"); PresenterModel model = new PresenterModel(); Trace.WriteLine("Make DeckMarshalService"); using (DeckMarshalService loader = new DefaultDeckMarshalService()) { Trace.WriteLine("Construct ViewerForm"); ViewerForm viewer = new ViewerForm(loader, model); ConnectionManager rtp = null; #if RTP_BUILD Trace.WriteLine("Make RTPConnectionManager"); rtp = new RTPConnectionManager(model); #endif ConnectionManager tcp = new TCPConnectionManager(model); #if RTP_BUILD Trace.WriteLine("Make BroadcastManager"); BroadcastManager bm = new BroadcastManager(model, (TCPConnectionManager)tcp, (RTPConnectionManager)rtp); #else BroadcastManager bm = new BroadcastManager(model, (TCPConnectionManager)tcp); #endif using (rtp) { using (tcp) { using (bm) { Trace.WriteLine("Make ViewerStateService"); using (ViewerStateService viewerState = new ViewerStateService(model.ViewerState)) { using (RegistryService registry = new RegistryService(model.ViewerState)) { using (RegistryService penreg = new RegistryService(model.PenState)) { #if DEBUG && LOGGING // Attach the logger to the model logger.AttachToModel(model.ViewerState); #endif #if STUDENT_CLIENT_ONLY using (Synchronizer.Lock(model.ViewerState.SyncRoot)){ model.ViewerState.iRole = 1; } #endif // Start the printing service PrintingService printing = new PrintingService(model.ViewerState); using (WorkspaceUndoService undo = new WorkspaceUndoService(viewer.m_EventQueue, model)) { using (Synchronizer.Lock(model.Network.SyncRoot)) { model.Network.Protocols.Add(tcp.Protocol); #if RTP_BUILD model.Network.Protocols.Add(rtp.Protocol); #endif } using (NetworkAssociationService association = new NetworkAssociationService(viewer.m_EventQueue, model)) { using (DeckMatcherService deckMatcher = new DeckMatcherService(viewer.m_EventQueue, model)) { // Set the Initial Deck to Load if we are Loading from an Icon viewer.OpenInputFiles = inputFiles; viewer.StandAlone = standalone; Trace.WriteLine("Ready to run viewer"); Application.Run(viewer); } } } penreg.SaveAllProperties(); } registry.SaveAllProperties(); } } } } } } #if WEBSERVER // Dispose of the web server web_server.Dispose(); #endif }
public void OnPrintCommand(object param) { #if SyncfusionFramework4_5_1 PageVM page = SelectedDiagram.PageSettings as PageVM; PrintingService print = SelectedDiagram.PrintingService; print.PrintMargin = page.PrintMargin; switch (page.SelectedFormat) { case PageSize.A0: print.PrintMediaSize = PrintMediaSize.IsoA0; break; case PageSize.A1: print.PrintMediaSize = PrintMediaSize.IsoA1; break; case PageSize.A2: print.PrintMediaSize = PrintMediaSize.IsoA2; break; case PageSize.A3: print.PrintMediaSize = PrintMediaSize.IsoA3; break; case PageSize.A4: print.PrintMediaSize = PrintMediaSize.IsoA4; break; case PageSize.A5: print.PrintMediaSize = PrintMediaSize.IsoA5; break; case PageSize.Folio: print.PrintMediaSize = PrintMediaSize.OtherMetricFolio; break; case PageSize.Ledger: print.PrintMediaSize = PrintMediaSize.NorthAmericaTabloid; break; case PageSize.Legal: print.PrintMediaSize = PrintMediaSize.NorthAmericaLegal; break; case PageSize.Letter: print.PrintMediaSize = PrintMediaSize.NorthAmericaLetter; break; } if (page.PageOrientation == PageOrientation.Landscape) { print.PrintOrientation = PrintOrientation.Landscape; } else { print.PrintOrientation = PrintOrientation.Portrait; } print.UnregisterForPrinting(); print.RegisterForPrinting(); //await Windows.Graphics.Printing.PrintManager.ShowPrintUIAsync(); #endif }
async public void OnPrintCommand(object param) { PageVM page = SelectedDiagram.PageSettings as PageVM; PrintingService print = SelectedDiagram.PrintingService as PrintingService; print.PrintMargin = page.PrintMargin; print.Height = page.PageHeight; print.Width = page.PageWidth; switch (page.SelectedFormat) { case PageSize.A0: print.PrintMediaSize = PrintMediaSize.IsoA0; break; case PageSize.A1: print.PrintMediaSize = PrintMediaSize.IsoA1; break; case PageSize.A2: print.PrintMediaSize = PrintMediaSize.IsoA2; break; case PageSize.A3: print.PrintMediaSize = PrintMediaSize.IsoA3; break; case PageSize.A4: print.PrintMediaSize = PrintMediaSize.IsoA4; break; case PageSize.A5: print.PrintMediaSize = PrintMediaSize.IsoA5; break; case PageSize.Folio: print.PrintMediaSize = PrintMediaSize.OtherMetricFolio; break; case PageSize.Ledger: print.PrintMediaSize = PrintMediaSize.NorthAmericaTabloid; break; case PageSize.Legal: print.PrintMediaSize = PrintMediaSize.NorthAmericaLegal; break; case PageSize.Letter: print.PrintMediaSize = PrintMediaSize.NorthAmericaLetter; break; } if (page.PageOrientation == PageOrientation.Landscape) { print.PrintOrientation = PrintOrientation.Landscape; } else { print.PrintOrientation = PrintOrientation.Portrait; } print.UnregisterForPrinting(); print.RegisterForPrinting(); //if (Windows.Graphics.Printing.PrintManager. { try { // Show print UI await Windows.Graphics.Printing.PrintManager.ShowPrintUIAsync(); } catch { // Printing cannot proceed at this time ContentDialog noPrintingDialog = new ContentDialog() { Title = "Printing error", Content = "\nSorry, printing can' t proceed at this time.", PrimaryButtonText = "OK" }; await noPrintingDialog.ShowAsync(); } } }
//Method to execute Print action private void OnPrintCommand(object obj) { PrintingService.Print(); }
// StorageFile file, /// <summary> /// Initializes a new instance of the <see cref="DiagramVM"/> class. /// </summary> /// <param name="file"> /// The file. /// </param> /// <param name="isValidXml"> /// The is valid xml. /// </param> public DiagramVM(string file, bool isValidXml) { this._isValidXml = isValidXml; this._file = file; this.Title = "Page"; if (this is OrganizationChartDiagramVM) { this.DiagramType = DiagramType.OrganizationChart; } else if (this is BrainstormingVM) { this.DiagramType = DiagramType.Brainstorming; } else if (this is FlowDiagramVm) { this.DiagramType = DiagramType.FlowChart; } else { this.DiagramType = DiagramType.Blank; } this.Nodes = new ObservableCollection <NodeVM>(); this.Connectors = new ObservableCollection <ConnectorVM>(); this.Groups = new ObservableCollection <GroupVM>(); this.SelectedItems = new SelectorVM(this); this.PortVisibility = PortVisibility.MouseOverOnConnect; this.FirstLoad = new Command(this.OnViewLoaded); this.HistoryManager = new CustomHistoryManager(); this.SnapSettings = new SnapSettings { SnapConstraints = SnapConstraints.All, SnapToObject = SnapToObject.All }; // Theme = new OfficeTheme(); this.PreviewSettings = new PreviewSettings { PreviewMode = PreviewMode.Preview }; LayoutManager = new LayoutManager(); DataSourceSettings = new DataSourceSettings(); this.PageSettings = new PageVM(); this.ScrollSettings = new ScrollSettings(); (this.PageSettings as PageVM).InitDiagram(this); this.HorizontalRuler = new Ruler { Orientation = Orientation.Horizontal }; this.VerticalRuler = new Ruler { Orientation = Orientation.Vertical }; this.InitLocation(); this.PrintingService = new PrintingService(); this.ExportSettings = new ExportSettings { ImageStretch = Stretch.Uniform, ExportMode = ExportMode.PageSettings }; #if SyncfusionFramework4_5_1 ExportSettings = new ExportSettings() { ImageStretch = Stretch.Uniform, ExportMode = ExportMode.PageSettings }; PrintingService = new PrintingService(); #endif this.FlipCommand = new Command(this.OnFlipCommand); this.ExportCommand = new Command(this.OnExportCommand); this.PrintCommand = new Command(this.OnPrintCommand); this.AddImageNode = new Command(this.OnAddImageNodeCommand); this.PageOrientationCommand = new Command(this.OnPageOrientationCommand); this.PageSizeCommand = new Command(this.OnPageSizeCommand); this.ConnectTypeCommand = new Command(this.OnConnectTypeCommand); this.SingleSelect = new Command(this.OnSingleSelectCommand); this.SizeAndPositionCommand = new Command(this.OnSizeAndPositionCommand); this.PanZoomCommand = new Command(this.OnPanZoomCommand); this.FitToWidthCommand = new Command(this.OnFitToWidthCommand); this.FitToPageCommand = new Command(this.OnFitToPageCommand); this.Constraints |= GraphConstraints.Undoable; }
public void OnItemClicked(object sender, MenuItemEventArgs e) { _layoutControl.PanMode = false; switch (e.ItemKey) { case LayoutMenuKeys.RestoreToolbars: _view.RestoreToolbars(); break; case LayoutMenuKeys.RestorePanels: _view.RestorePanels(); break; case LayoutMenuKeys.ShowRulers: _layoutControl.ShowRulers = !_layoutControl.ShowRulers; break; case LayoutMenuKeys.AdjustPages: _layoutControl.UpdateLayout(); break; case LayoutMenuKeys.SelectAll: _layoutControl.SelectAll(); break; case LayoutMenuKeys.SelectNone: _layoutControl.ClearSelection(); break; case LayoutMenuKeys.InvertSelection: _layoutControl.InvertSelection(); break; case LayoutMenuKeys.ConvertToBitmap: ConvertElementToBitmap(); break; case LayoutMenuKeys.MoveUp: _layoutControl.MoveSelectionUp(); break; case LayoutMenuKeys.MoveDown: _layoutControl.MoveSelectionDown(); break; case LayoutMenuKeys.DeleteElement: _layoutControl.DeleteSelected(); break; case LayoutMenuKeys.ShowMargins: _layoutControl.ShowMargins = !_layoutControl.ShowMargins; break; case LayoutMenuKeys.ShowPageNumbers: _layoutControl.ShowPageNumbers = !_layoutControl.ShowPageNumbers; break; case LayoutMenuKeys.NewLayout: if (PromptSaveExistingLayout()) { _layoutControl.Filename = string.Empty; _layoutControl.ClearLayout(); } break; case LayoutMenuKeys.SaveLayout: SaveLayout(false); break; case LayoutMenuKeys.SaveLayoutAs: SaveLayout(true); break; case LayoutMenuKeys.LoadLayout: var ls = new LayoutSerializer(); ls.LoadNewLayout(_layoutControl, _context, _view.Model.Extents, _view as IWin32Window); break; case LayoutMenuKeys.Print: { var service = new PrintingService(); service.Print(_layoutControl.Pages, _layoutControl.PrinterSettings, _layoutControl.LayoutElements); } break; case LayoutMenuKeys.PrinterSetup: RunPrinterSetup(); break; case LayoutMenuKeys.PageSetup: RunPageSetup(); break; case LayoutMenuKeys.ExportToPdf: _pdfService.ExportToPdf(_layoutControl, ParentView); break; case LayoutMenuKeys.ExportToBitmap: ExportToBitmap(); break; case LayoutMenuKeys.ZoomIn: _layoutControl.ZoomIn(); break; case LayoutMenuKeys.ZoomOut: _layoutControl.ZoomOut(); break; case LayoutMenuKeys.ZoomFitScreen: _layoutControl.ZoomFitToScreen(); break; case LayoutMenuKeys.ZoomOriginal: _layoutControl.Zoom = 1; break; case LayoutMenuKeys.AddMap: AddMap(); break; case LayoutMenuKeys.AddLegend: AddLegend(); break; case LayoutMenuKeys.AddScaleBar: AddScaleBar(); break; case LayoutMenuKeys.AddNorthArrow: _layoutControl.AddElementWithMouse(new LayoutNorthArrow()); break; case LayoutMenuKeys.AddTable: AddTable(); break; case LayoutMenuKeys.AddLabel: _layoutControl.AddElementWithMouse(new LayoutText()); break; case LayoutMenuKeys.AddRectangle: _layoutControl.AddElementWithMouse(new LayoutRectangle()); break; case LayoutMenuKeys.AddBitmap: AddBitmap(); break; case LayoutMenuKeys.ZoomToMaximum: { var map = SelectedMapElement; if (map != null) { map.ZoomToMaxExtents(); } } break; case LayoutMenuKeys.ZoomToOriginalExtents: { var map = SelectedMapElement; if (map != null) { map.ZooomToOriginalExtents(); } } break; case LayoutMenuKeys.MapZoomIn: { var map = SelectedMapElement; if (map != null) { _layoutControl.ZoomInMap(map); } } break; case LayoutMenuKeys.MapZoomOut: { var map = SelectedMapElement; if (map != null) { _layoutControl.ZoomOutMap(map); } } break; case LayoutMenuKeys.MapPan: { _layoutControl.PanMode = true; } break; } _view.UpdateView(); }