コード例 #1
0
        public override void Execute(object parameter)
        {
            var selectedItems = GetSelectedItems();

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

            var items = GetProjects(selectedItems);
            var item  = items[0];

            var project = ProjectManager.GetProject(item.FileName);

            if (project == null)
            {
                return;
            }

            var site = project.Site;

            if (site == null)
            {
                return;
            }

            var siteEditor = new SiteEditor();

            siteEditor.Load(site);

            if (AppHost.Shell.ShowDialog(siteEditor) != true)
            {
                return;
            }

            ConnectionManager.Save();

            project.HostName = site.HostName;
            project.UserName = site.UserName;
            project.Save();

            Notifications.RaiseSiteChanged(this, site);

            var editor = siteEditor.DataServiceEditor as WebServiceSiteEditor;

            if (editor != null)
            {
                if (editor.AutomaticUpdate.IsChecked == true)
                {
                    UpdateServerComponentsDialog.AutomaticUpdate(site.DataService, site.Name, site.WebRootPath, site);
                }
            }
        }
コード例 #2
0
        public override void Execute(object parameter)
        {
            var context = parameter as ContentTreeContext;

            if (context == null)
            {
                return;
            }

            var item = context.SelectedItems.FirstOrDefault() as SiteTreeViewItem;

            if (item == null)
            {
                return;
            }

            var site = GetSite(context.SelectedItems);

            if (site == null)
            {
                return;
            }

            var oldHostName = site.HostName;
            var oldUserName = site.UserName;

            var siteEditor = new SiteEditor();

            siteEditor.Load(site);
            if (AppHost.Shell.ShowDialog(siteEditor) != true)
            {
                return;
            }

            ConnectionManager.Save();

            item.UpdateStatus();
            item.Text = site.Name;
            item.Refresh();

            Notifications.RaiseSiteChanged(this, site);
            Notifications.RaiseSiteModified(this, site, oldHostName, oldUserName);

            Update(siteEditor, site);
        }