public ProjectStartPageView(IEventAggregator eventAggregator, IWorkbenchService workbenchService)
 {
     _eventAggregator = eventAggregator;
     this.HideOnClose = false;
     this.TabText     = "Browser";
     _browserPane.View.GetSchemeFunc = (sender, e) =>
     {
         if (e.SchemeName.Equals(ProjectStartPageScheme.SCHEMENAME, StringComparison.CurrentCultureIgnoreCase))
         {
             return(ProjectStartPageScheme.Instance);
         }
         else
         {
             return(null);
         }
     };
     _browserPane.View.StatusTextChanged = (e) => { workbenchService.SetStatusMessage(e); };
     _browserPane.View.TitleChanged      = (e) => { this.TabText = e; };
     this.Controls.Add(_browserPane.View);
     _browserPane.Navigate(ProjectStartPageScheme.PROJECT_STARTPAGE_URI);
     this.Single      = true;
     this.SingleKey   = ProjectStartPageScheme.PROJECT_STARTPAGE_URI;
     this.HideOnClose = true;
     SubscribeEvents();
 }
        private void FormDesignSurfaceHosting_FormClosing(object sender, FormClosingEventArgs e)
        {
            //判断是否做了更改还没保存
            //但是需要注意,如果是直接关FormHostingContainer窗体,这些Hosting子窗体的FormClosing,FormClosed都不会触发
            if (_dirty)
            {
                this.Activate();

                SEMessageBox msgBox = new SEMessageBox(SEMessageBoxStyle.CmdLink);
                msgBox.Icon    = SEMessageBoxIcon.Question;
                msgBox.Caption = CommonLanguage.Current.MessageCaption_Notice;
                msgBox.Text    = String.Format(Language.Current.FormDesignSurfaceHosting_MessageIsSave, this.WindowEntity.Name);
                msgBox.AddButton(
                    new SEMessageBoxButton(CommonLanguage.Current.MessageBoxButton_Yes,
                                           Language.Current.FormDesignSurfaceHosting_MessageIsSave_YesButtonDescription)
                {
                    Result = DialogResult.Yes
                },
                    new SEMessageBoxButton(CommonLanguage.Current.MessageBoxButton_No,
                                           Language.Current.FormDesignSurfaceHosting_MessageIsSave_NoButtonDescription)
                {
                    Result = DialogResult.No
                },
                    new SEMessageBoxButton(CommonLanguage.Current.MessageBoxButton_Cancel)
                {
                    Result = DialogResult.Cancel, IsCancelButton = true
                }
                    );
                DialogResult result = msgBox.Show(this).Result;

                if (result == DialogResult.Yes)
                {
                    _windowComponentService.Save(this.WindowEntity);
                    _workbenchService.SetStatusMessage(Language.Current.StatusBarMessage_Saved);
                }
                else if (result == DialogResult.Cancel)
                {
                    e.Cancel = true;
                    return;
                }
            }
        }
Beispiel #3
0
 public BrowserView(BrowserPane browserPane, Uri url)
 {
     InitializeComponent();
     this.HideOnClose  = false;
     this.TabText      = "Browser";
     _workbenchService = ServiceUnity.Container.Resolve <IWorkbenchService>();
     browserPane.View.StatusTextChanged = (e) => { _workbenchService.SetStatusMessage(e); };
     browserPane.View.TitleChanged      = (e) => { this.TabText = e; };
     browserPane.View.NewWindow        += (sender, e) => { _workbenchService.Show(new BrowserView(e.BrowserPane, e.Url)); };
     this.Controls.Add(browserPane.View);
     browserPane.Navigate(url.ToString());
 }