Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Editor"/> class.
        /// </summary>
        public Editor()
        {
            DefaultStyleKey = typeof( Editor );

            Expanders = new ObservableCollection<EditableExpander> ();
            Expanders.CollectionChanged += Expanders_CollectionChanged;

            ExpandAllCommand = new DelegateCommand ( ExecuteExpandAllCommand );
            CollapseAllCommand = new DelegateCommand ( ExecuteCollapseAllCommand );
            MaximizeCommand = new DelegateCommand ( ExecuteMaximizeCommand );

                _popupWindow = new PopupWindow();
                _popupWindow.Closed += PopupClosed;

            Loaded += Editor_Loaded;
        }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EditableExpander"/> class.
 /// </summary>
 public EditableExpander()
 {
     DefaultStyleKey = typeof( EditableExpander );
     SetAsNextCommand = new DelegateCommand ( ExecuteSetAsNextCommand );
     MaximizeCommand = new DelegateCommand ( ExecuteMaximizeCommand );
     _popupWindow = new PopupWindow ();
     _popupWindow.Closed += PopupClosed;
     _contentInTree = true;
 }
Beispiel #3
0
 /// <summary>
 /// Shows the notification popup.
 /// </summary>
 /// <param name="viewUri">The view URI.</param>
 public void ShowNotificationPopup( Uri viewUri )
 {
     var popupWindow = new PopupWindow ();
     popupWindow.SubContent = InternalShowNotification ( new Region (), viewUri );
     popupWindow.Show ();
 }
Beispiel #4
0
        private void ShowPopup(string viewName, Uri uri, string title, Action completedAction, bool maximize = false, bool isModal = false)
        {
            if ( !_popupWindows.ContainsKey ( viewName ) )
            {
                var navigationContext = new NavigationContext ( null, uri );
                object view;
                try
                {
                    view = _regionNavigationContentLoader.LoadContent ( new Region (), navigationContext );
                }
                catch ( Exception e )
                {
                    OnLoadContentException ( e );
                    view = null;
                }
                if ( view != null )
                {
                    if ( view is FrameworkElement )
                    {
                        var navigatable = ( view as FrameworkElement ).DataContext as INavigationAware;
                        if ( navigatable != null )
                        {
                            navigatable.OnNavigatedTo ( navigationContext );
                        }
                    }

                    var configurationBehaviorService = new ConfigurationBehaviorService();
                    if ( isModal )
                    {
                        var popupWindow = new PopupWindow();
                        popupWindow.IsMaximized = maximize;
                        if (title == null)
                        {
                            SetupPopupWindowTitle ( popupWindow, view );
                        }
                        else
                        {
                            popupWindow.Title = title;
                        }

                        popupWindow.SubContent = view;
                        popupWindow.IsModal = isModal;
                        _popupWindows.Add(viewName, popupWindow);

                        configurationBehaviorService.Watch(popupWindow);
                        EventHandler closedEventHandler = null;
                        closedEventHandler = (s, e) =>
                        {
                            popupWindow.Closed -= closedEventHandler;
                            configurationBehaviorService.Stop();
                            _popupWindows.Remove(viewName);
                            completedAction.Invoke();
                        };
                        popupWindow.Closed += closedEventHandler;
                        popupWindow.Show();
                    }
                    else
                    {
                        var floatableWindow = new FloatableWindow ();

                        if( floatableWindow.Title == null)
                        {
                            SetupPopupWindowTitle ( floatableWindow, view );
                        }
                        else
                        {
                            floatableWindow.Title = title;
                        }

                        floatableWindow.Content = view;
                        _popupWindows.Add(viewName, floatableWindow);
                        configurationBehaviorService.Watch(floatableWindow);

                        EventHandler closedEventHandler = null;
                        closedEventHandler = (s, e) =>
                        {
                            floatableWindow.Closed -= closedEventHandler;
                            configurationBehaviorService.Stop();
                            _popupWindows.Remove(viewName);
                            completedAction.Invoke();
                        };
                        floatableWindow.Closed += closedEventHandler;
                        floatableWindow.Show();
                    }
                }
            }
        }
Beispiel #5
0
 /// <summary>
 /// Shows the detail popup.
 /// </summary>
 /// <param name="content">The content.</param>
 public void ShowDetailPopup( object content )
 {
     var popupWindow = new PopupWindow ();
     popupWindow.SubContent = content;
     var closeViewBinding = new Binding ();
     closeViewBinding.Source = content;
     closeViewBinding.Path = new PropertyPath ( "DataContext.CloseViewCommand" );
     popupWindow.SetBinding ( PopupWindow.ClosingCommandProperty, closeViewBinding );
     popupWindow.Show ();
 }