Exemplo n.º 1
0
 public DocumentViewModel(Document document, IDocumentService documentService)
 {
     this.service = documentService;
     this.Model = document;
     this.mode = DocumentMode.Edit;
     this.IsBusy = false;
 }
Exemplo n.º 2
0
        protected override void OnViewLoaded()
        {
            ParserDispatcherManager.EnsureParserDispatcherIsCreated();

            DocumentOutliningMode mode = null;

            if (!string.IsNullOrEmpty(Settings.Instance.DocumentOutliningMode))
            {
                mode = OutliningModes.FirstOrDefault(m => m.Name == Settings.Instance.DocumentOutliningMode);
            }

            if (mode == null)
            {
                mode = OutliningModes.FirstOrDefault(m => m.Name == "Enabled");
            }

            SelectedOutliningMode = mode;

            if (Database.Value != null)
            {
                Database.Value.DocumentChanges.TakeUntil(Unloaded)
                .ObserveOnDispatcher()
                .Subscribe(HandleChangeNotification);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Receive notification of the document mode.
 /// </summary>
 /// <param name="mode">The document mode.</param>
 /// <param name="publicIdentifier">The public identifier of the doctype or <c>null</c> if unavailable.</param>
 /// <param name="systemIdentifier">The system identifier of the doctype or <c>null</c> if unavailable.</param>
 /// <param name="html4SpecificAdditionalErrorChecks"><c>true</c>  if HTML 4-specific checks were enabled,
 /// <c>false</c> otherwise</param>
 public DocumentModeEventArgs(DocumentMode mode, string publicIdentifier, string systemIdentifier, bool html4SpecificAdditionalErrorChecks)
 {
     Mode             = mode;
     PublicIdentifier = publicIdentifier;
     SystemIdentifier = systemIdentifier;
     Html4SpecificAdditionalErrorChecks = html4SpecificAdditionalErrorChecks;
 }
 /// <summary>
 /// Receive notification of the document mode.
 /// </summary>
 /// <param name="mode">The document mode.</param>
 /// <param name="publicIdentifier">The public identifier of the doctype or <c>null</c> if unavailable.</param>
 /// <param name="systemIdentifier">The system identifier of the doctype or <c>null</c> if unavailable.</param>
 /// <param name="html4SpecificAdditionalErrorChecks"><c>true</c>  if HTML 4-specific checks were enabled,
 /// <c>false</c> otherwise</param>
 public DocumentModeEventArgs(DocumentMode mode, string publicIdentifier, string systemIdentifier, bool html4SpecificAdditionalErrorChecks)
 {
     Mode = mode;
     PublicIdentifier = publicIdentifier;
     SystemIdentifier = systemIdentifier;
     Html4SpecificAdditionalErrorChecks = html4SpecificAdditionalErrorChecks;
 }
Exemplo n.º 5
0
 public DocumentViewModel(IDocumentService documentService)
 {
     this.Model = new Document();
     this.service = documentService;
     this.mode = DocumentMode.Create;
     this.IsBusy = false;
 }
Exemplo n.º 6
0
 public void AppendDoctype(DoctypeToken token)
 {
     this.DoctypeInfo = DoctypeInfo.CreateDoctypeInfo(token);
     XmlNode result = this.CreateDocumentType(token.Name, token.PublicIdentifier, token.SystemIdentifier, null);
     this.AppendChild(result);
     if(this.DocumentMode == DocumentMode.UnKnown){
         this.DocumentMode = this.DoctypeInfo.DocumentMode;
     }
 }
Exemplo n.º 7
0
 Document IDocumentFactory.CreateDocument(DocumentProjectItem projectItem, bool readOnly, DocumentMode mode, DocumentViewType initialView, out DocumentWindow documentWindow, out DesignerHost designerHost)
 {
     if (projectItem == null)
     {
         throw new ArgumentNullException("projectItem");
     }
     Document document = new AshxDocument(projectItem);
     designerHost = new DesignerHost(document);
     document.Load(readOnly);
     documentWindow = new AshxDocumentWindow(designerHost, document);
     return document;
 }
Exemplo n.º 8
0
 Document IDocumentFactory.CreateDocument(DocumentProjectItem projectItem, bool readOnly, DocumentMode mode, DocumentViewType initialView, out DocumentWindow documentWindow, out DesignerHost designerHost)
 {
     if (projectItem == null)
     {
         throw new ArgumentNullException("projectItem");
     }
     TableDocument document = new TableDocument(projectItem);
     designerHost = new DesignerHost(document);
     document.Load(readOnly);
     if (initialView == DocumentViewType.Default)
     {
         initialView = (document.Table.GetRowCount() == 0) ? DocumentViewType.Design : DocumentViewType.Source;
     }
     documentWindow = new TableDocumentWindow(designerHost, document, initialView);
     return document;
 }
Exemplo n.º 9
0
		protected override void OnViewLoaded()
		{
			ParserDispatcherManager.EnsureParserDispatcherIsCreated();

			DocumentOutliningMode mode = null;

			if (!string.IsNullOrEmpty(Settings.Instance.DocumentOutliningMode))
			{
				mode = OutliningModes.FirstOrDefault(m => m.Name == Settings.Instance.DocumentOutliningMode);
			}

			if (mode == null)
			{
				mode = OutliningModes.FirstOrDefault(m => m.Name == "Enabled");
			}

			SelectedOutliningMode = mode;

			if (Database.Value != null)
			{
				Database.Value.DocumentChanges.TakeUntil(Unloaded)
				        .ObserveOnDispatcher()
				        .Subscribe(HandleChangeNotification);
			}
		}
Exemplo n.º 10
0
 Document IDocumentFactory.CreateDocument(DocumentProjectItem projectItem, bool readOnly, DocumentMode mode, DocumentViewType initialView, out DocumentWindow documentWindow, out DesignerHost designerHost)
 {
     throw new NotSupportedException("Invalid use of CodeDocumentFactory. This class only exists to represent a arbitrary code file.");
 }
Exemplo n.º 11
0
        /// <summary>
        /// Opens a DataStoreItemViewModel in a modal pop-up document
        /// </summary>
        /// <param name="_itemViewModel">The DataStoreItemViewModel to be opened.</param>
        public async static void MakeModalDocument(DataStoreItemViewModel _itemViewModel, DocumentMode mode)
        {
            //ActiveWindow.Closing -= w_Closing;

            ChildWindow w = new ChildWindow();

            w.OverlayBrush     = null;
            w.CloseByEscape    = true;
            w.Background       = new SolidColorBrush(Color.FromRgb(255, 255, 255));
            w.EnableDropShadow = true;
            w.OverlayBrush     = new SolidColorBrush(Colors.Gray)
            {
                Opacity = 0.5
            };
            w.AllowMove       = true;
            w.ShowTitleBar    = true;
            w.ShowCloseButton = true;

            UserControl control = GetView(_itemViewModel);

            control.Margin = new Thickness(2.0);

            control.DataContext = _itemViewModel;

            w.Content               = control;
            ActiveWindow            = w;
            _itemViewModel.Closing += _itemViewModel_ViewModelClosing;


            string t = Regex.Replace(_itemViewModel.Item.ConcreteType.Name, "([a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))", "$1 ");

            w.Title = t;
            MainWindow.ShowDialogsOverTitleBar = true;

            await MainWindow.ShowChildWindowAsync(w, ChildWindowManager.OverlayFillBehavior.FullWindow);
        }
Exemplo n.º 12
0
            public static bool TryParse(string value, out DocumentMode result)
            {
                result = default(DocumentMode);

                if( value=="producer")
                    result = DocumentMode.Producer;
                else if( value=="consumer")
                    result = DocumentMode.Consumer;
                else
                    return false;

                return true;
            }
Exemplo n.º 13
0
 internal void setMode(DocumentMode mode)
 {
     docmode=mode;
 }
        public Dock(DocumentMode mode, string path = "")
        {
            try
            {
                object missing = System.Reflection.Missing.Value;

                switch (mode)
                {
                    case DocumentMode.Create:
                        {
                            _docApp = new Application();
                            _docApp.Visible = false;

                            _doc = _docApp.Documents.Add(ref missing, ref missing, ref missing, ref missing);
                            _doc.Save();
                        }
                        break;

                    case DocumentMode.CreatFromTemplate:
                        {
                            _docApp = new Application();
                            _docApp.Visible = false;

                            object template = path;
                            object newTemplate = true;

                            _doc = _docApp.Documents.Add(template, newTemplate);
                        }
                        break;

                    case DocumentMode.Load:
                        {
                            _docApp = new Application();
                            _docApp.Visible = false;

                            object FileName = path;

                            _doc = _docApp.Documents.Open(ref FileName);
                        }
                        break;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 15
0
 Document IDocumentFactory.CreateDocument(DocumentProjectItem projectItem, bool readOnly, DocumentMode mode, DocumentViewType initialView, out DocumentWindow documentWindow, out DesignerHost designerHost)
 {
     if (projectItem == null)
     {
         throw new ArgumentNullException("projectItem");
     }
     Document document = new HtmlDocument(projectItem);
     designerHost = new DesignerHost(document);
     document.Load(readOnly);
     if (initialView == DocumentViewType.Default)
     {
         initialView = WebPackage.Instance.WebDefaultView;
     }
     documentWindow = new HtmlDocumentWindow(designerHost, document, initialView);
     return document;
 }
Exemplo n.º 16
0
        /// <summary>
        /// Run when the document mode is set.
        /// </summary>
        ///
        /// <param name="mode">
        /// The mode.
        /// </param>
        /// <param name="publicIdentifier">
        /// DocType public identifier.
        /// </param>
        /// <param name="systemIdentifier">
        /// DocType system identifier.
        /// </param>
        /// <param name="html4SpecificAddcionalErrorChecks">
        /// true to HTML 4 specific addcional error checks.
        /// </param>

        protected override void ReceiveDocumentMode(DocumentMode mode, String publicIdentifier,
                                                    String systemIdentifier, bool html4SpecificAddcionalErrorChecks)
        {
            //document.setUserData("nu.validator.document-mode", mode, null); // TODO
        }
Exemplo n.º 17
0
 Document IDocumentFactory.CreateDocument(DocumentProjectItem projectItem, bool readOnly, DocumentMode mode, DocumentViewType initialView, out DocumentWindow documentWindow, out DesignerHost designerHost)
 {
     if (projectItem == null)
     {
         throw new ArgumentNullException("projectItem");
     }
     if (initialView == DocumentViewType.Default)
     {
         initialView = WebPackage.Instance.WebDefaultView;
         if (initialView == DocumentViewType.Source)
         {
             initialView = DocumentViewType.Composite;
         }
     }
     documentWindow = null;
     AscxDocument document = new AscxDocument(projectItem);
     designerHost = new WebFormsDesignerHost(document);
     document.Load(readOnly);
     Page page = null;
     UserControl child = null;
     if (document.DocumentDirective.Inherits.ToLower().IndexOf("mobile") < 0)
     {
         page = new Page();
         child = new UserControl();
         child.ID = "Page";
         documentWindow = new AscxDocumentWindow(designerHost, document, initialView);
         page.Site = new AscxPageSite(designerHost, page);
         page.DesignerInitialize();
         page.Controls.Add(child);
     }
     else
     {
         if (!_mobileAssemblyLoadFailed)
         {
             if (_mobileAssembly == null)
             {
                 _mobileAssembly = Assembly.LoadWithPartialName(_mobileAssemblyName);
             }
             if (_mobileAssembly != null)
             {
                 document.Dispose();
                 document = new AscxDocument(projectItem);
                 Type type = _mobileAssembly.GetType("System.Web.UI.MobileControls.MobilePage");
                 Type type2 = _mobileAssembly.GetType("System.Web.UI.MobileControls.MobileUserControl");
                 Type type3 = _mobileAssembly.GetType("System.Web.UI.MobileControls.Form");
                 page = (Page) Activator.CreateInstance(type);
                 child = (UserControl) Activator.CreateInstance(type2);
                 Control control2 = (Control) Activator.CreateInstance(type3);
                 Type type4 = Type.GetType("Microsoft.Matrix.Packages.Web.Mobile.MobileDesignerHost, Microsoft.Matrix.Packages.Web.Mobile");
                 designerHost = (DesignerHost) Activator.CreateInstance(type4, new object[] { document });
                 document.Load(readOnly);
                 Type type5 = Type.GetType("Microsoft.Matrix.Packages.Web.Mobile.MobileWebFormsDocumentWindow, Microsoft.Matrix.Packages.Web.Mobile");
                 documentWindow = (DocumentWindow) Activator.CreateInstance(type5, new object[] { designerHost, document, initialView });
                 page.Site = new AscxPageSite(designerHost, page);
                 page.DesignerInitialize();
                 page.Controls.Add(control2);
                 control2.Controls.Add(child);
             }
             else
             {
                 _mobileAssemblyLoadFailed = true;
             }
         }
         if (_mobileAssemblyLoadFailed)
         {
             document.Dispose();
             Document document2 = new TextDocument(projectItem);
             designerHost = new DesignerHost(document2);
             ((IMxUIService) designerHost.GetService(typeof(IMxUIService))).ReportError("Microsoft Mobile Internet Toolkit is required for design-time editing of mobile user controls.\r\nPlease visit 'http://www.asp.net/mobile/default.aspx' for more information.\r\nThe user control will be opened in the text editor instead.", "Mobile User Controls are not enabled.", true);
             document2.Load(readOnly);
             documentWindow = new TextDocumentWindow(designerHost, document2);
             return document2;
         }
     }
     IDesignerHost host = designerHost;
     host.Container.Add(child, "UserControl");
     child.DesignerInitialize();
     return document;
 }
Exemplo n.º 18
0
 public static string ToString(DocumentMode value)
 {
     if( value==DocumentMode.Producer )
         return "producer";
     else if( value==DocumentMode.Consumer )
         return "consumer";
     else
         throw new ArgumentException("Unrecognized DocumentMode value: " + value.ToString());
 }
Exemplo n.º 19
0
 public DocumentManager(IServiceProvider serviceProvider, bool isDebugger)
 {
     this._serviceProvider = serviceProvider;
     this._documentMode = !isDebugger ? DocumentMode.Editing : DocumentMode.Debugging;
 }