/// <summary>
        /// Loads the specified *.flo file and schema configuration. If the Designer saved
        /// state is not found, a new layout will be loaded.
        /// </summary>
        /// <param name="workflow">Active workflow.</param>
        /// <param name="guid">Relevant module guid.</param>
        /// <param name="schema">The schema.</param>
        /// <param name="data">The data.</param>
        public void Load(Workflow workflow, Guid guid, Field schema, XDocument data)
        {
            ModuleGuid = guid;
            Workflow   = workflow;
            SchemaData = data;
            Schema     = schema;

            var element = workflow.GetAppState(APP_NAME, guid);

            ResetState();
            if (element != null)
            {
                using (var reader = element.CreateReader()) {
#if DEBUG
                    ReadXml(reader);
                    return;
#else
                    try {
                        ReadXml(reader);
                        return;
                    }
                    catch (Exception e) {
                        var msg = $"Could not load saved workflow: {e.Message}. Falling back to a new workflow.";
                        Logger.Log(Severity.ERROR, LogCategory.APP, msg);
                        MessageBox.Show(msg, "", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
#endif
                }
            }

            DesignerControl.LoadDefault();
        }
Example #2
0
 public DesignerBoard Warp()
 {
     foreach (object obj in this.Children)
     {
         if (obj is DesignerItem)
         {
             //获取DesignerItem中直接包含的BoardControl
             DesignerControl clonedChild = (DesignerControl)((obj as DesignerItem).Content as IDesigner).GetDesignerModel();
             this.Board.AddVisualControl(clonedChild);
             if (clonedChild is DesignerChart)
             {
                 foreach (DesignerChartDataSerie dcd in (clonedChild as DesignerChart).Series)
                 {
                     IDynamicData idd = dcd as IDynamicData;
                     if (!string.IsNullOrEmpty(idd.DataSourceKey))
                     {
                         DesignerDataSource ds = DataSourceManager.GetDataSource(idd.DataSourceKey);
                         this.Board.AddBackControl(ds);
                     }
                 }
             }
             //若该设计模型是动态数据类型,则将该数据接口添加至Board的后台元素集合中
             if (clonedChild is IDynamicData)
             {
                 IDynamicData idd = clonedChild as IDynamicData;
                 if (!string.IsNullOrEmpty(idd.DataSourceKey))
                 {
                     DesignerDataSource ds = DataSourceManager.GetDataSource(idd.DataSourceKey);
                     this.Board.AddBackControl(ds);
                 }
             }
         }
     }
     return(this.Board);
 }
        public void Dispose()
        {
            PopupBase.SourceModule = null;

            this.Tag = null;

            // Designer
            StiOptions.WCFService.WCFRenderReport   -= WCFRenderReport;
            StiOptions.WCFService.WCFTestConnection -= WCFTestConnection;
            StiOptions.WCFService.WCFBuildObjects   -= WCFBuildObjects;
            //StiOptions.WCFService.WCFRetrieveColumns -= WCFRetrieveColumns;
            StiOptions.WCFService.WCFOpeningReportInDesigner      -= WCFOpeningReportInDesigner;
            StiOptions.WCFService.WCFRequestFromUserRenderReport  -= WCFRequestFromUserRenderReport;
            StiOptions.Engine.GlobalEvents.SavingReportInDesigner -= GlobalEvents_SavingReportInDesigner;

            // Interactions
            StiOptions.WCFService.WCFRenderingInteractions -= WCFRenderingInteractions;

            // Prepare RequestFromUser Variables
            StiOptions.WCFService.WCFPrepareRequestFromUserVariables -= WCFPrepareRequestFromUserVariables;
            StiOptions.WCFService.WCFInteractiveDataBandSelection    -= WCFInteractiveDataBandSelection;

            //if (reportDomain != null)
            //{
            //    AppDomain.Unload(reportDomain);
            //    reportDomain = null;
            //}

            StiReport.ClearImageCache();
            StiReport.ClearReportCache();

            //designer.DesignerPreviewControl.TargetUpdated = null;
            //designer.DesignerPreviewControl = null;
            //designer.Report.ClearAllStates();

            //designer.PageView.Dispose();

            //var report = designer.Report;
            //if (report != null)
            //{
            //    report.Dictionary.DataStore.Clear();
            //    if (report.CompiledReport != null) report.CompiledReport.DataStore.Clear();

            //    report.Dispose();
            //}
            //designer.Report = null;

            //designer.DictionaryPanelService.Dispose();
            //designer.CurrentTool.Dispose();

            //LayoutGrid.Content = null;

            DesignerControl.Proryv_Dispose(null);


            GC.Collect();
            GC.WaitForPendingFinalizers();
            GC.Collect();
        }
Example #4
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Funs.Window = this;
            Messenger.Default.Register <CallbackMessage <InputVM> >(this, Notifications.InputShow, ShowInput);
            Messenger.Default.Register <PropertyChangedMessage <ReportVM> >(this, ReportChanged);
            Messenger.Default.Register <ReportVM>(this, Notifications.ReportPreview, ReportPreview);
            Messenger.Default.Register <ReportVM>(this, Notifications.ReportSave, ReportSave);
            Messenger.Default.Register <CallbackMessage <ReportVM> >(this, Notifications.ReportSaveAs, ReportSaveAs);

            FastReport.Utils.Res.LocaleFolder = "Localization";
            var file = FastReport.Utils.Res.LocaleFolder + @"Chinese (Simplified).frl";

            FastReport.Utils.Res.LoadLocale(file);

            _settings.PreviewSettings.Buttons =
                PreviewButtons.Print |
                //PreviewButtons.Email |
                PreviewButtons.Find |
                PreviewButtons.Zoom |
                PreviewButtons.Outline |
                PreviewButtons.PageSetup |
                //PreviewButtons.Edit |
                PreviewButtons.Watermark |
                PreviewButtons.Navigator |
                PreviewButtons.Close;
            _settings.PreviewSettings.Icon         = new System.Drawing.Icon("LabelPrinter.ico");
            _settings.DesignerSettings.DefaultFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            _settings.UIStyle = FastReport.Utils.UIStyle.Office2007Blue;

            _designer = new DesignerControl();
            //_designer.IsPreviewPageDesigner = false;
            //_designer.ShowMainMenu = false;
            _designer.MainMenu.miFile.Visible        = false;
            _designer.MainMenu.miData.Visible        = false;
            _designer.MainMenu.miHelp.Visible        = false;
            _designer.MainMenu.miReport.Visible      = false;
            _designer.MainMenu.miFileExit.Visible    = false;
            _designer.MainMenu.miViewOptions.Visible = false;

            _designer.Restrictions.DontEditCode   = true;
            _designer.Restrictions.DontDeletePage = true;
            _designer.Restrictions.DontInsertBand = true;
            //_designer.Restrictions.DontInsertObject = true;
            //_designer.Restrictions.DontChangeReportOptions = true;
            _designer.Restrictions.DontCreateData = true;
            _designer.Restrictions.DontEditData   = true;
            //_designer.Restrictions.DontChangePageOptions = true;
            _designer.Restrictions.DontShowRecentFiles = true;
            _designer.Restrictions.DontPreviewReport   = true;
            _designer.Restrictions.DontCreateReport    = true;
            _designer.Restrictions.DontSaveReport      = true;
            _designer.Restrictions.DontLoadReport      = true;
            _designer.Restrictions.DontCreatePage      = true;
            //_designer.UIStyle = FastReport.Utils.UIStyle.Office2007Black;
            _designer.RestoreConfig();
            _designer.Report = _report;
            _designer.RefreshLayout();
            wfhDesign.Child = _designer;
        }
        internal SetLayerActiveRecord(ViewModel.ViewModelController controller, DesignerControl designer, ViewModel.Layer newLayer, ViewModel.Layer oldLayer) : base(ActionTypes.AddLayer, controller, newLayer)
        {
            Designer   = designer;
            OldLayerId = oldLayer?.Id ?? TrackableObject.NullId;
#if DEBUGUNDOREDO
            Debug.WriteLine($@">>> SetLayerActiveRecord.SetLayerActiveRecord: Created {UnitDescription} record, ID: {Id}, Name: {newLayer.Name}, Old Layer ID: {OldLayerId}, Old Layer Name: {oldLayer?.Name ?? "<null>"}");
#endif
        }
Example #6
0
        public override void ZoomIn()
        {
            CellDetailBox        box     = new CellDetailBox(Text);
            SingleElementSurface surface = new SingleElementSurface(null, box);
            DesignerControl      control = DesignerControl.GetDesigner(this);

            control.Push(surface, Strings.Analyzer_TextDetailTitle);
        }
 internal SearchTask(uint dwCookie, IVsSearchQuery pSearchQuery, IVsSearchCallback pSearchCallback, DesignerControl designer)
 {
     Designer       = designer;
     Id             = dwCookie;
     SearchQuery    = pSearchQuery;
     SearchCallback = pSearchCallback;
     Status         = (uint)__VSSEARCHTASKSTATUS.STS_CREATED;
 }
Example #8
0
 private static DesignerItem createCommandItem()
 {
     var item = new DesignerItem();
     item.Type = ItemType.Command;
     item.Width = 250;
     item.Height = 65;
     var control = new DesignerControl();
     control.Titel = "New Command";
     control.ContentGrid.Content = new CommandControl();
     item.Content = control;
     return item;
 }
Example #9
0
 private static DesignerItem createTriggerItem()
 {
     var item = new DesignerItem();
     item.Type = ItemType.Trigger;
     item.Width = 250;
     item.Height = 250;
     var control = new DesignerControl();
     control.Titel = "New Trigger";
     control.ContentGrid.Content = new TriggerControl();
     item.Content = control;
     return item;
 }
Example #10
0
 public static UserControl CreateBoardControlByDesignerType(Type type, DesignerControl dc)
 {
     if (ClassToClassDictionary.Keys.Contains(type))
     {
         Type   controlType = ClassToClassDictionary[type];
         ICandy candy       = (ICandy)controlType.Assembly.CreateInstance(controlType.FullName);
         return(candy.GetCandy(dc));
     }
     else
     {
         throw new Exception("未注册的类名");
     }
 }
Example #11
0
 public override void ZoomIn()
 {
     if (HasUnqualifiedChildElement(_element))
     {
         PlanTree surface = new PlanTree();
         surface.Set(_element);
         DesignerControl.GetDesigner(this).Push(surface, String.Format(Strings.Analyzer_PlanNodeTitle, _element.Name.LocalName));
     }
     else
     {
         DesignerControl.GetDesigner(this).Push(new SingleElementSurface(_element, new DetailedPlanNodeBox(_element)), String.Format(Strings.Analyzer_DetailNodeTitle, _element.Name.LocalName));
     }
 }
        public void ReadXml(XmlReader reader)
        {
            reader.ReadStartElement();
            var serializer = new XmlSerializer(typeof(Pages));

            DesignerControl.Load((Pages)serializer.Deserialize(reader));
            if (reader.NodeType != XmlNodeType.EndElement)
            {
                DesignerControl.LoadTreeItems(reader);
            }

            reader.ReadEndElement();
        }
Example #13
0
        public frmTemplateConstruct(IDBQuery dbHelper, string imgKind)
        {
            InitializeComponent();

            designerControl1 = new DesignerControl();
            panel2.Controls.Add(designerControl1);
            designerControl1.Dock = DockStyle.Fill;

            _dbHelper = dbHelper;
            _imgKind  = imgKind;

            _rwm = new ReportWordsModel(dbHelper);
            _rtm = new ReportTemplateModel(dbHelper);
        }
Example #14
0
        public override void ZoomIn()
        {
            XElement element = (XElement)Node.Element;

            DetailedPlanNodeBox box = new DetailedPlanNodeBox(element);

            box.RoundRadius  = this.RoundRadius;
            box.SurfaceColor = this.SurfaceColor;
            SingleElementSurface surface = new SingleElementSurface(element, box);

            DesignerControl control = DesignerControl.GetDesigner(this);

            control.Push(surface, Text);
        }
Example #15
0
 void Add(UserControl uc, DesignerControl dc)
 {
     uc.SetBinding(Canvas.LeftProperty, new Binding("Position.Location.X")
     {
         Source = dc
     });
     uc.SetBinding(Canvas.TopProperty, new Binding("Position.Location.Y")
     {
         Source = dc
     });
     uc.SetBinding(Canvas.ZIndexProperty, new Binding("Position.ZIndex")
     {
         Source = dc
     });
     MainPanel.Children.Add(uc);
 }
        public ViewDesignerView()
        {
            InitializeComponent();

            _designerControl      = new DesignerControl();
            _designerControl.Dock = DockStyle.Fill;

            TabPageDesigner.Controls.Add(_designerControl);
            _designerControl.OnLayoutChanged += s =>
            {
                if (MessageBox.Show(
                        @"Create new form layout? All existing layout will be replaced.",
                        Resources.NeedConfirm, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) ==
                    DialogResult.OK)
                {
                    RefreshView(s);
                }
            };
        }
        /// <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 CreateReportEditor()
        {
            DeleteDesignerConfiguration();
            ResetDesignerSettings();
            DisableNotSupportedObjects();

            _reportEditor = new DesignerControl();

            MainPanel.Controls.Add(_reportEditor);

            _reportEditor.Dock            = DockStyle.Fill;
            _reportEditor.BorderStyle     = BorderStyle.None;
            _reportEditor.UIStyle         = UIStyle.VisualStudio2005;
            _reportEditor.ShowMainMenu    = false;
            _reportEditor.UIStateChanged += OnReportModified;

            PrepareReportEditor();

            _bandConfigView = new ReportBandConfigView();
            _bandConfigView.ReportChanged += (s, e) => RefreshReport();
        }
Example #19
0
        /// <summary>
        /// Called after the WindowPane has been sited with an IServiceProvider from the environment
        ///
        protected override void Initialize()
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            base.Initialize();

            // Create and initialize the editor
            #region Register with IOleComponentManager
            IOleComponentManager componentManager = (IOleComponentManager)GetService(typeof(SOleComponentManager));
            if (this._componentId == 0 && componentManager != null)
            {
                OLECRINFO[] crinfo = new OLECRINFO[1];
                crinfo[0].cbSize            = (uint)Marshal.SizeOf(typeof(OLECRINFO));
                crinfo[0].grfcrf            = (uint)_OLECRF.olecrfNeedIdleTime | (uint)_OLECRF.olecrfNeedPeriodicIdleTime;
                crinfo[0].grfcadvf          = (uint)_OLECADVF.olecadvfModal | (uint)_OLECADVF.olecadvfRedrawOff | (uint)_OLECADVF.olecadvfWarningsOff;
                crinfo[0].uIdleTimeInterval = 100;
                int hr = componentManager.FRegisterComponent(this, crinfo, out this._componentId);
                ErrorHandler.Succeeded(hr);
            }
            #endregion

            ComponentResourceManager resources = new ComponentResourceManager(typeof(EditorPane));

            #region Hook Undo Manager
            // Attach an IOleUndoManager to our WindowFrame. Merely calling QueryService
            // for the IOleUndoManager on the site of our IVsWindowPane causes an IOleUndoManager
            // to be created and attached to the IVsWindowFrame. The WindowFrame automaticall
            // manages to route the undo related commands to the IOleUndoManager object.
            // Thus, our only responsibilty after this point is to add IOleUndoUnits to the
            // IOleUndoManager (aka undo stack).
            _undoManager = (IOleUndoManager)GetService(typeof(SOleUndoManager));

            // In order to use the IVsLinkedUndoTransactionManager, it is required that you
            // advise for IVsLinkedUndoClient notifications. This gives you a callback at
            // a point when there are intervening undos that are blocking a linked undo.
            // You are expected to activate your document window that has the intervening undos.
            if (_undoManager != null)
            {
                IVsLinkCapableUndoManager linkCapableUndoMgr = (IVsLinkCapableUndoManager)_undoManager;
                if (linkCapableUndoMgr != null)
                {
                    linkCapableUndoMgr.AdviseLinkedUndoClient(this);
                }
            }
            #endregion

            // hook up our
            _model             = ViewModelCoordinator.GetViewModel(_fileName, _textBuffer);
            _model.UndoManager = _undoManager;

            // Set up the build action for this file
            SetBuildAction(_fileName);

            // This is the user control hosted by the tool window; Note that, even if this class implements IDisposable,
            // we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on
            // the object returned by the Content property.
            _vsDesignerControl = new DesignerControl(_thisPackage, _model, GetService(typeof(STrackSelection)) as ITrackSelection);
            Content            = _vsDesignerControl;

            RegisterIndependentView(true);

            IMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as IMenuCommandService;
            if (null != mcs)
            {
                // Now create one object derived from MenuCommnad for each command defined in
                // the CTC file and add it to the command service.

                // For each command we have to define its id that is a unique Guid/integer pair, then
                // create the OleMenuCommand object for this command. The EventHandler object is the
                // function that will be called when the user will select the command. Then we add the
                // OleMenuCommand to the menu service.  The addCommand helper function does all this for us.
                AddCommand(mcs, VSConstants.GUID_VSStandardCommandSet97, (int)VSStd97CmdID.ViewCode,
                           new EventHandler(OnViewCode), new EventHandler(OnQueryViewCode));
            }

            InitializeToolbox();
        }
Example #20
0
        public UserControl GetCandy(DesignerControl control)
        {
            BoardClock bf = new BoardClock(control as DesignerClock);

            return(bf);
        }
Example #21
0
        public UserControl GetCandy(DesignerControl control)
        {
            BoardImage bf = new BoardImage(control as DesignerImage);

            return(bf);
        }
 internal DraggableIcon(DesignerControl designer, ITrackableObject o, System.Windows.Point?center, Size?size) :
     base(designer, o, center, size)
 {
 }
Example #23
0
 internal LayeredPositionableIcon(DesignerControl designer, ObjectModel.LayeredPositionableObject layeredPositionalObject, System.Windows.Point?center, System.Windows.Point?leftTop, Size iconSize) :
     base(designer, layeredPositionalObject, center ?? new System.Windows.Point(Math.Max(0, leftTop.Value.X + iconSize.Width / 2), Math.Max(0, leftTop.Value.Y + iconSize.Width / 2)), iconSize)
 {
 }
 internal PositionableIcon(DesignerControl designer, TrackableObject o, Point?center, Size?size) : base(designer, o, center, size)
 {
 }
Example #25
0
      public UserControl GetCandy(DesignerControl control)
      {
          BoardProcessbar bf = new BoardProcessbar(control as DesignerProcessbar);

          return(bf);
      }
Example #26
0
        public UserControl GetCandy(DesignerControl control)
        {
            BoardMediaPlayer bf = new BoardMediaPlayer(control as DesignerMedia);

            return(bf);
        }
        public UserControl GetCandy(DesignerControl control)
        {
            BoardDynamicLabel bf = new BoardDynamicLabel(control as DesignerDynamicLabel);

            return(bf);
        }
Example #28
0
 internal SelectionBoxIcon(DesignerControl designer, Point?center, Size?size) : base(designer, null, center, size)
 {
     Path = new PathGeometry();
 }
Example #29
0
        public UserControl GetCandy(DesignerControl control)
        {
            BoardChart chart = new BoardChart(control as DesignerChart);

            return(chart);
        }
Example #30
0
        public UserControl GetCandy(DesignerControl control)
        {
            BoardGif bf = new BoardGif(control as DesignerGif);

            return(bf);
        }
Example #31
0
        public UserControl GetCandy(DesignerControl control)
        {
            BoardDataGrid bf = new BoardDataGrid(control as DesignerTable);

            return(bf);
        }
        private void UpdatePropertiesPane()
        {
            var oldDesigner = PropertyWindow.Content as DesignerControl;

            if (oldDesigner != null)
            {
                oldDesigner.HandleClosed();
            }

            PropertyWindow.Content = EmptySelectionPane;

            var selectedItems = TreeView.SelectedItems;

            if (selectedItems.Count() != 1)
            {
                return;
            }

            object context = null;

            if (TreeView.SelectedItems.All(i => i is RenderingTreeViewItem))
            {
                var renderingTreeViewItem = selectedItems.OfType <RenderingTreeViewItem>().FirstOrDefault();
                if (renderingTreeViewItem == null)
                {
                    return;
                }

                context = new RenderingContext(renderingTreeViewItem);
            }

            if (TreeView.SelectedItems.All(i => i is PlaceHolderTreeViewItem))
            {
                var placeHolderTreeViewItem = selectedItems.OfType <PlaceHolderTreeViewItem>().FirstOrDefault();
                if (placeHolderTreeViewItem == null)
                {
                    return;
                }

                context = new PlaceHolderContext(placeHolderTreeViewItem);
            }

            if (TreeView.SelectedItems.All(i => i is PageTreeViewItem))
            {
                var pageTreeViewItem = selectedItems.OfType <PageTreeViewItem>().FirstOrDefault();
                if (pageTreeViewItem != null)
                {
                    context = new PageContext(pageTreeViewItem.PageModel);
                }
            }

            if (TreeView.SelectedItems.All(i => i is DeviceTreeViewItem))
            {
                var deviceTreeViewItem = selectedItems.OfType <DeviceTreeViewItem>().FirstOrDefault();
                if (deviceTreeViewItem != null)
                {
                    context = new DeviceContext(deviceTreeViewItem.Device);
                }
            }

            if (context == null)
            {
                return;
            }

            var renderingDesigner = new DesignerControl(context);

            PropertyWindow.Content = renderingDesigner;
        }