// ******************************************************************
        void ObjCollCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            // Find the DataTemplate
            if (e.Action == NotifyCollectionChangedAction.Add)
            {
                foreach (object obj in e.NewItems)
                {
                    // Here th obj Type is the key to the resource, it works but
                    var key          = new System.Windows.DataTemplateKey(obj.GetType());
                    var dataTemplate = (DataTemplate)DockSite.FindResource(key);

                    var userControl = dataTemplate.LoadContent() as UserControl;
                    if (userControl != null)
                    {
                        userControl.DataContext = obj;

                        var documentWindow = new DocumentWindow(DockSite, null, "Title from viemodel", null, userControl);
                        documentWindow.Description = "viewModel.Description";

                        // Activate the document
                        documentWindow.Activate();
                    }
                }
            }
        }
Exemplo n.º 2
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////
        // NON-PUBLIC PROCEDURES
        /////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Creates the designer.
        /// </summary>
        private void CreateDesigner()
        {
            // Create an instance of WorkflowDesigner class.
            designer = new WorkflowDesigner();

            // Load a Sequence as a default
            var root = new Sequence()
            {
                Activities =
                {
                    new Assign(),
                    new WriteLine()
                }
            };

            designer.Load(root);

            // Create an expression editor service
            expressionEditorService = new ExpressionEditorService(designer);
            designer.Context.Services.Publish <IExpressionEditorService>(expressionEditorService);

            // Add to a document window
            var documentWindow = new DocumentWindow(dockSite, "Designer1", "Designer1", null, designer.View);

            documentWindow.CanClose = false;
            documentWindow.Activate();
        }
Exemplo n.º 3
0
        public void SelectWindow(string filename)
        {
            DocumentWindow window = FindDocumentWindow(filename);

            if (window != null)
            {
                window.Activate();
            }
        }
Exemplo n.º 4
0
        public void OnActivate(UIElement smartPart)
        {
            activeSmartPart = smartPart;

            DocumentWindow window = ResolveSmartPartToWindow(smartPart);

            window.Activate(true);

            if (window.Visibility != Visibility.Visible)
            {
                window.Visibility = Visibility.Visible;
            }
        }
Exemplo n.º 5
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////
        // NON-PUBLIC PROCEDURES
        /////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Creates a new web browser <see cref="DocumentWindow"/>.
        /// </summary>
        /// <param name="url">The URL to load.</param>
        /// <returns>The <see cref="DocumentWindow"/> that was created.</returns>
        private DocumentWindow CreateBrowserWindow(string url)
        {
            var browser = new WebBrowser();

            InteropFocusTracking.SetIsEnabled(browser, true);
            WebBrowserBehavior.SetAreScriptErrorsDisabled(browser, true);

            // Create the document
            var documentWindow = new DocumentWindow(dockSite, "Browser" + (++browserIndex), "New Tab", null, browser);

            // Activate the document
            documentWindow.Activate();

            // Navigate to a page
            browser.Navigate(url);

            return(documentWindow);
        }
Exemplo n.º 6
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////
        // NON-PUBLIC PROCEDURES
        /////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Creates a new text <see cref="DocumentWindow"/>.
        /// </summary>
        /// <param name="dockSite">The owner <see cref="DockSite"/>.</param>
        /// <param name="filename">The filename to open; <c>null</c> to create a new document.</param>
        /// <param name="documentIndex">The document index, if a new document is being created.</param>
        /// <returns>The <see cref="DocumentWindow"/> that was created.</returns>
        private static DocumentWindow CreateTextDocumentWindow(DockSite dockSite, string filename, int documentIndex)
        {
            if (dockSite == null)
            {
                throw new ArgumentNullException("dockSite");
            }

            // Create a TextBox
            var textBox = new TextBox();

            textBox.BorderThickness             = new Thickness(0);
            textBox.TextWrapping                = TextWrapping.Wrap;
            textBox.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;

            string name, title;

            if (filename != null)
            {
                // Open an existing document
                textBox.Text = File.ReadAllText(filename);
                name         = System.IO.Path.GetFileNameWithoutExtension(filename);
                title        = System.IO.Path.GetFileName(filename);
            }
            else
            {
                // Create a new document
                textBox.Text = String.Format("Document {0} created at {1}.", documentIndex, DateTime.Now);
                name         = String.Format("Document{0}", documentIndex);
                title        = String.Format("Document{0}.txt", documentIndex);
                filename     = title;
            }

            // Create the document
            var documentWindow = new DocumentWindow(dockSite, name, title,
                                                    new BitmapImage(new Uri("/Resources/Images/TextDocument16.png", UriKind.Relative)), textBox);

            documentWindow.Description = "Text document";
            documentWindow.FileName    = filename;

            // Activate the document
            documentWindow.Activate();

            return(documentWindow);
        }
Exemplo n.º 7
0
        private void window_Click(object sender, EventArgs e)
        {
            DocumentWindow window = (sender as ButtonItem).Tag as DocumentWindow;

            window.Activate();
        }
Exemplo n.º 8
0
		private void method_0(object sender, NotifyCollectionChangedEventArgs e)
		{
			Console.WriteLine("ChildCollection_CollectionChanging " + e.Action);
			IEnumerator enumerator;
			switch (e.Action)
			{
			case NotifyCollectionChangedAction.Add:
				enumerator = e.NewItems.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						object current = enumerator.Current;
						object obj = this.ChildTemplate.LoadContent();
						if (!(obj is Panel))
						{
							throw new Exception("The ChildTemplate MUST create a root node of type \"Panel\" (ex. Panel)");
						}
						DocumentWindow documentWindow = new DocumentWindow(this.dockSite_0);
						documentWindow.DataContext = current;
						documentWindow.Content = obj;
						documentWindow.CanAttach = new bool?(false);
						documentWindow.CanDockBottom = new bool?(false);
						documentWindow.CanDockTop = new bool?(false);
						documentWindow.CanDockLeft = new bool?(false);
						documentWindow.CanDockRight = new bool?(false);
						BindingOperations.SetBinding(documentWindow, DockingWindow.TitleProperty, new Binding("Name"));
						documentWindow.Activate(true);
						this.observableCollection_0.Add(documentWindow);
					}
					return;
				}
				finally
				{
					IDisposable disposable = enumerator as IDisposable;
					if (disposable != null)
					{
						disposable.Dispose();
					}
				}
				break;
			case NotifyCollectionChangedAction.Remove:
				break;
			case NotifyCollectionChangedAction.Replace:
				goto IL_1AD;
			case NotifyCollectionChangedAction.Move:
				return;
			case NotifyCollectionChangedAction.Reset:
				throw new Exception("Rest Not Yet Supported");
			default:
				return;
			}
			enumerator = e.OldItems.GetEnumerator();
			try
			{
				object item;
				while (enumerator.MoveNext())
				{
					item = enumerator.Current;
					DockingWindow dockingWindow = (from dw in this.observableCollection_0
					where dw.DataContext == item
					select dw).FirstOrDefault<DockingWindow>();
					if (dockingWindow != null)
					{
						dockingWindow.Close();
					}
				}
				return;
			}
			finally
			{
				IDisposable disposable = enumerator as IDisposable;
				if (disposable != null)
				{
					disposable.Dispose();
				}
			}
			IL_1AD:
			throw new Exception("Replace not yet supported");
		}