コード例 #1
0
        private void InternalExecute()
        {
            ISolutionManagement solutionManagement = this.Solution() as ISolutionManagement;

            if (solutionManagement == null)
            {
                return;
            }
            if (!this.SaveSolution(true))
            {
                return;
            }
            string      parentDirectory     = Microsoft.Expression.Framework.Documents.PathHelper.GetParentDirectory(Microsoft.Expression.Framework.Documents.PathHelper.GetDirectory(solutionManagement.DocumentReference.Path));
            CultureInfo currentCulture      = CultureInfo.CurrentCulture;
            string      newNameCopyTemplate = StringTable.NewNameCopyTemplate;

            object[] fileNameWithoutExtension     = new object[] { Path.GetFileNameWithoutExtension(solutionManagement.DocumentReference.DisplayName) };
            string   availableFileOrDirectoryName = string.Format(currentCulture, newNameCopyTemplate, fileNameWithoutExtension);

            availableFileOrDirectoryName = Microsoft.Expression.Framework.Documents.PathHelper.GetAvailableFileOrDirectoryName(availableFileOrDirectoryName, null, parentDirectory, true);
            if (base.PromptUserForNewNameAndPath(ref parentDirectory, ref availableFileOrDirectoryName, false) == ProjectDialog.ProjectDialogResult.Ok)
            {
                using (IDisposable disposable = TemporaryCursor.SetWaitCursor())
                {
                    Directory.CreateDirectory(parentDirectory);
                    solutionManagement.SaveCopy(parentDirectory, availableFileOrDirectoryName);
                }
            }
        }
コード例 #2
0
        public void MakeHierarchicalCollection()
        {
            if (!this.schemaItem.Schema.DataSource.IsSampleDataSource)
            {
                return;
            }
            SampleDataSet       sampleData    = this.schemaItem.Schema.DataSource.SampleData;
            SampleCompositeType effectiveType = this.DataSchemaNode.EffectiveType;

            if (effectiveType == null)
            {
                return;
            }
            this.model.SelectionContext.Clear();
            SampleNonBasicType sampleNonBasicType   = (SampleNonBasicType)this.DataSchemaNode.SampleType;
            string             uniquePropertyName1  = effectiveType.GetUniquePropertyName(this.DataSchemaNode.PathName);
            SampleProperty     hierarchicalProperty = effectiveType.AddProperty(uniquePropertyName1, (SampleType)sampleNonBasicType);
            SampleProperty     sampleProperty       = this.DataSchemaNode.EffectiveParentType.GetSampleProperty(this.DataSchemaNode.PathName);
            string             uniquePropertyName2  = DataSchemaItem.GetUniquePropertyName(sampleProperty, hierarchicalProperty, uniquePropertyName1);
            string             schemaNodePath       = DataSchemaItem.ProvideNodePathForPendingEdit(this, uniquePropertyName2, sampleProperty, hierarchicalProperty);

            sampleProperty.Rename(uniquePropertyName2);
            hierarchicalProperty.Rename(uniquePropertyName2);
            this.model.RenameSampleDataSchemaItemUponRebuild(this.schemaItem.Schema.DataSource, schemaNodePath);
            this.model.ExtendSelectionUponRebuild(this.schemaItem.Schema.DataSource, schemaNodePath);
            this.IsExpanded = true;
            using (TemporaryCursor.SetWaitCursor())
                sampleData.CommitChanges(this.ViewModel.DesignerContext.MessageDisplayService);
        }
コード例 #3
0
        protected IEnumerable <INamedProject> CreateNewProject()
        {
            IEnumerable <INamedProject> namedProjects;

            LicensingHelper.SuppressDialogForSession();
            using (IDisposable disposable = TemporaryCursor.SetWaitCursor())
            {
                List <TemplateArgument> templateArguments = new List <TemplateArgument>();
                if (this.targetFrameworkVersion != null)
                {
                    templateArguments.Add(new TemplateArgument("targetframeworkversion", this.targetFrameworkVersion.Value));
                    templateArguments.Add(new TemplateArgument("clientprofile", "True"));
                }
                IEnumerable <INamedProject> namedProjects1 = this.ProjectManager().CreateProjectTemplate(this.projectFolder, this.projectName, this.projectTemplate, templateArguments);
                if (this.targetFrameworkVersion != null)
                {
                    this.configurationObject.SetProperty(BaseNewProjectCommand.LastProjectTargetFrameworkCreated, this.targetFrameworkVersion.Value);
                }
                if (this.projectTemplate != null)
                {
                    this.configurationObject.SetProperty(BaseNewProjectCommand.LastProjectTemplateCreated, this.projectTemplate.Identifier);
                }
                this.configurationObject.SetProperty(BaseNewProjectCommand.LastProjectLanguageCreated, this.projectFilter);
                namedProjects = namedProjects1;
            }
            return(namedProjects);
        }
コード例 #4
0
        public void AddCollection()
        {
            if (!this.schemaItem.Schema.DataSource.IsSampleDataSource)
            {
                return;
            }
            SampleDataSet       sampleData    = this.schemaItem.Schema.DataSource.SampleData;
            SampleCompositeType effectiveType = this.DataSchemaNode.EffectiveType;

            if (effectiveType == null)
            {
                return;
            }
            this.model.SelectionContext.Clear();
            string uniquePropertyName           = effectiveType.GetUniquePropertyName("Collection");
            string uniqueTypeName               = sampleData.GetUniqueTypeName(uniquePropertyName + "Item");
            SampleCompositeType  compositeType  = sampleData.CreateCompositeType(uniqueTypeName);
            SampleCollectionType collectionType = sampleData.CreateCollectionType((SampleNonBasicType)compositeType);

            effectiveType.AddProperty(uniquePropertyName, (SampleType)collectionType);
            string schemaNodePath = DataSchemaItem.ProvideNodePathForPendingEdit(this, uniquePropertyName);

            this.model.RenameSampleDataSchemaItemUponRebuild(this.schemaItem.Schema.DataSource, schemaNodePath);
            this.model.ExtendSelectionUponRebuild(this.schemaItem.Schema.DataSource, schemaNodePath);
            this.IsExpanded = true;
            using (TemporaryCursor.SetWaitCursor())
                sampleData.CommitChanges(this.ViewModel.DesignerContext.MessageDisplayService);
        }
コード例 #5
0
 public override void ResetToDefault()
 {
     if (!this.IsLocal)
     {
         return;
     }
     using (TemporaryCursor.SetWaitCursor())
     {
         SceneDocument sceneDocument = this.ProjectItem.Document as SceneDocument;
         if (sceneDocument != null && this.ProjectItem.FileExists)
         {
             using (SceneEditTransaction editTransaction = sceneDocument.CreateEditTransaction(StringTable.UndoUnitResetDocumentToDefault))
             {
                 ((XamlDocument)sceneDocument.DocumentRoot).Text = this.originalDocumentProvider.Document.Text;
                 editTransaction.Commit();
             }
         }
         else
         {
             if (this.ProjectItem.IsOpen)
             {
                 this.ProjectItem.CloseDocument();
             }
             this.ProjectItem.CreateDocument(this.originalDocumentProvider.Document.Text);
         }
     }
 }
コード例 #6
0
 internal void InitializeDialog()
 {
     this.itemListMessageBubble = new MessageBubbleHelper((UIElement)this.ProjectItemTypeList, (IMessageBubbleValidator) new ProjectItemTypeValidator());
     this.itemNameMessageBubble = new MessageBubbleHelper((UIElement)this.NameTextBox, (IMessageBubbleValidator) new ProjectItemNameValidator(this.project));
     using (TemporaryCursor.SetWaitCursor())
         this.InitializeDialogInternal();
 }
コード例 #7
0
 public DocumentNode GetThemeResourceFromAssembly(IProjectContext projectContext, IAssembly themeRuntimeAssembly, IAssembly themeTargetAssembly, object resourceKey, out IList <DocumentCompositeNode> auxillaryResources)
 {
     using (TemporaryCursor.SetWaitCursor())
     {
         foreach (string str1 in ThemeContentProvider.GetThemeNames(projectContext))
         {
             string str2 = string.Format((IFormatProvider)CultureInfo.InvariantCulture, "themes/{0}.xaml", new object[1]
             {
                 (object)str1.ToLowerInvariant()
             });
             IProjectContext   projectContext1  = (IProjectContext) new ThemeContentProvider.TargetThemeAssemblyProjectContext(projectContext, themeRuntimeAssembly, this.designerContext.AssemblyService);
             DocumentReference theme            = DocumentReference.Create(Path.Combine(themeTargetAssembly.Name, str2));
             DocumentNode      resourceInternal = this.GetResourceInternal(this.projectThemeCache, projectContext.Platform.ThemeManager, projectContext1, theme, themeTargetAssembly, str2, resourceKey, out auxillaryResources);
             if (resourceInternal != null)
             {
                 return(resourceInternal);
             }
         }
         if (projectContext.Platform.ThemeManager.AllowFallbackToPlatform)
         {
             return(this.GetThemeResourceFromPlatform(projectContext.Platform, resourceKey, out auxillaryResources));
         }
         auxillaryResources = (IList <DocumentCompositeNode>)null;
         return((DocumentNode)null);
     }
 }
コード例 #8
0
ファイル: UpgradeWizard.cs プロジェクト: radtek/Shopdrawing
        public bool Upgrade()
        {
            bool?nullable;

            if (ConversionSupressor.IsSupressed)
            {
                return(true);
            }
            bool   hasErrors = false;
            string str       = null;

            UpgradeWizard.UpgradeResponse upgrade = this.converter.PromptToUpgrade(this.versionMapping, out nullable, ref str, out this.proposedUpgrades);
            if (upgrade != UpgradeWizard.UpgradeResponse.Upgrade)
            {
                hasErrors = upgrade == UpgradeWizard.UpgradeResponse.DontUpgrade;
            }
            else
            {
                using (ProjectUpgradeLogger projectUpgradeLogger = new ProjectUpgradeLogger())
                {
                    hasErrors = true;
                    using (IDisposable disposable = TemporaryCursor.SetWaitCursor())
                    {
                        foreach (UpgradeAction proposedUpgrade in this.proposedUpgrades)
                        {
                            if (proposedUpgrade.DoUpgrade())
                            {
                                continue;
                            }
                            hasErrors = false;
                        }
                    }
                    hasErrors = hasErrors & !projectUpgradeLogger.HasErrors;
                    if (hasErrors && this.solutionUpgradedAction != null)
                    {
                        this.solutionUpgradedAction();
                    }
                    if (hasErrors && !string.IsNullOrEmpty(str))
                    {
                        MessageBoxArgs messageBoxArg = new MessageBoxArgs()
                        {
                            Message          = StringTable.UpgradeUpgradeAndBackupSuccess,
                            Button           = MessageBoxButton.OK,
                            Image            = MessageBoxImage.Asterisk,
                            AutomationId     = "BackupAndUpgradeCompletedDialog",
                            HyperlinkMessage = StringTable.UpgradeBackupFolderLink,
                            HyperlinkUri     = new Uri(str)
                        };
                        this.serviceProvider.MessageDisplayService().ShowMessage(messageBoxArg);
                    }
                    UpgradeWizard.SaveLogAndPromptUser(projectUpgradeLogger, this.serviceProvider, this.solution.DocumentReference.Path, hasErrors);
                }
            }
            if (nullable.HasValue && nullable.Value)
            {
                this.converter.IsEnabled = false;
            }
            return(hasErrors);
        }
コード例 #9
0
 public void WorkWithoutProgress()
 {
     using (TemporaryCursor.SetWaitCursor())
     {
         this.Begin();
         this.Model.Dispatcher = new DispatcherHelper();
         this.Model.Dispatcher.ClearFrames(Dispatcher.CurrentDispatcher);
     }
     this.ShowDefaultDialogs();
 }
コード例 #10
0
 public void SetValue(ConfigurationPlaceholder control, object value)
 {
     if (control != ConfigurationPlaceholder.RandomLatinWordCount && control != ConfigurationPlaceholder.RandomLatinWordLength && control != ConfigurationPlaceholder.StringFormat)
     {
         return;
     }
     this.stringConfigurator.SetConfigurationValue(control, value);
     using (TemporaryCursor.SetWaitCursor())
         DesignDataGenerator.UpdateDesignValues(this.designDataFile, this.property, (ISampleTypeConfiguration)this.stringConfigurator);
 }
コード例 #11
0
 public void SetValue(ConfigurationPlaceholder control, object value)
 {
     this.configuration.SetConfigurationValue(control, value);
     using (TemporaryCursor.SetWaitCursor())
     {
         this.property.ChangeTypeAndFormat((SampleType)this.configuration.SampleType, this.configuration.Format, this.configuration.FormatParameters);
         if (this.property.PropertySampleType == SampleBasicType.Image)
         {
             this.property.DeclaringDataSet.EnsureSampleImages();
         }
         this.property.DeclaringDataSet.CommitChanges(this.messageService);
     }
 }
コード例 #12
0
 public bool AddEventHandler(Type returnType, string methodName, ICollection <IParameterDeclaration> parameters)
 {
     if (this.classModel == null)
     {
         return(false);
     }
     if (this.ShouldSaveFiles)
     {
         this.SaveFiles();
     }
     using (TemporaryCursor.SetWaitCursor())
         return(this.classModel.AddMethod(returnType, methodName, (IEnumerable <IParameterDeclaration>)parameters));
 }
コード例 #13
0
        public DocumentNode GetThemeResourceFromPlatform(IPlatform platform, object resourceKey, out IList <DocumentCompositeNode> auxillaryResources)
        {
            auxillaryResources = (IList <DocumentCompositeNode>)null;
            FolderBasedThemeManager basedThemeManager = platform.ThemeManager as FolderBasedThemeManager;

            if (basedThemeManager == null)
            {
                return((DocumentNode)null);
            }
            using (TemporaryCursor.SetWaitCursor())
            {
                Dictionary <ThemeContentProvider.PlatformSpecificDocumentReference, ThemeContentProvider.SystemThemeContentProvider> orCreateCache = DesignSurfacePlatformCaches.GetOrCreateCache <Dictionary <ThemeContentProvider.PlatformSpecificDocumentReference, ThemeContentProvider.SystemThemeContentProvider> >(platform.Metadata, DesignSurfacePlatformCaches.ThemeContentProviderCache);
                DocumentReference fileThemeReference = ThemeContentProvider.GetFileThemeReference(basedThemeManager.ThemeFolder, basedThemeManager.CurrentTheme);
                return(this.GetResourceInternal(orCreateCache, (ThemeManager)basedThemeManager, (IProjectContext)null, fileThemeReference, (IAssembly)null, (string)null, resourceKey, out auxillaryResources));
            }
        }
コード例 #14
0
 public void Activate()
 {
     if (this.IsActiveScope)
     {
         return;
     }
     using (TemporaryCursor.SetWaitCursor())
     {
         this.ActiveViewModel.MoveToEditContext(this.editContext);
         if (!this.HasExplicitSelection)
         {
             return;
         }
         this.LocalViewModel.ElementSelectionSet.SetSelection(this.SelectedElement);
     }
 }
コード例 #15
0
 public void CommitChanges()
 {
     if (!this.isModified)
     {
         return;
     }
     this.isModified       = false;
     this.processedChanges = 0;
     for (int index = this.editingCollectionNode.Children.Count - 1; index >= this.RowCount; --index)
     {
         this.editingCollectionNode.Children.RemoveAt(index);
     }
     if (this.rowCountChanged)
     {
         this.EqualizeSubCollectionItemCount(2);
     }
     using (TemporaryCursor.SetWaitCursor())
         this.SampleDataSet.CommitChanges(this.editingRootNode, this.messageService);
 }
コード例 #16
0
        private void OnActivateCommand()
        {
            PerformanceUtility.MeasurePerformanceUntilRender(PerformanceEvent.ActivateProjectItem);
            INamedProject namedProject = base.Services.ProjectManager().CurrentSolution.FindProjectContainingOpenItem(this.projectItem.DocumentReference);

            if (namedProject != null && namedProject != this.ProjectItem.Project)
            {
                base.Services.MessageDisplayService().ShowError(StringTable.ProjectItemAlreadyOpenMessage);
                return;
            }
            IView activeView = base.Services.ViewService().ActiveView;

            if (!this.projectItem.DocumentType.CanView)
            {
                if (this.projectItem is FolderStandIn || this.projectItem.DocumentType == base.Services.DocumentTypes()[DocumentTypeNamesHelper.Folder])
                {
                    this.IsExpanded = !this.IsExpanded;
                    return;
                }
                if (activeView != null && this.projectItem.DocumentType.CanInsertTo(this.projectItem, activeView))
                {
                    this.projectItem.DocumentType.AddToDocument(this.projectItem, activeView);
                    return;
                }
                if (Microsoft.Expression.Framework.Documents.PathHelper.FileExists(this.projectItem.DocumentReference.Path))
                {
                    CommandTarget commandTarget = base.Services.ProjectManager() as CommandTarget;
                    if (commandTarget != null)
                    {
                        string str = "Project_EditExternally";
                        commandTarget.SetCommandProperty(str, "TargetDocument", this.ProjectItem);
                        commandTarget.Execute(str, CommandInvocationSource.Palette);
                    }
                }
            }
            else
            {
                using (IDisposable disposable = TemporaryCursor.SetWaitCursor())
                {
                    this.projectItem.OpenView(true);
                }
            }
        }
コード例 #17
0
        private void ChangeEffectivePropertyIfValid(DataSchemaItem.ModifySamplePropertyOperation operation)
        {
            SampleCompositeType effectiveParentType = this.DataSchemaNode.EffectiveParentType;

            if (effectiveParentType == null)
            {
                return;
            }
            SampleDataSet  declaringDataSet = effectiveParentType.DeclaringDataSet;
            SampleProperty sampleProperty   = effectiveParentType.GetSampleProperty(this.DataSchemaNode.PathName);

            if (sampleProperty == null)
            {
                return;
            }
            operation(effectiveParentType, sampleProperty);
            using (TemporaryCursor.SetWaitCursor())
                declaringDataSet.CommitChanges(this.ViewModel.DesignerContext.MessageDisplayService);
        }
コード例 #18
0
        protected override bool OnDrop(DragEventArgs args)
        {
            ISceneInsertionPoint dropInsertionPoint = this.DragDropInsertionPoint;
            Point position = args.GetPosition((IInputElement)this.ActiveView.ViewRootContainer);

            this.ToolBehaviorContext.SnappingEngine.Start(this.ToolBehaviorContext, (BaseFrameworkElement)null, (IList <BaseFrameworkElement>)null);
            Point point     = this.ToolBehaviorContext.SnappingEngine.SnapPoint(position, EdgeFlags.All);
            Point dropPoint = this.ActiveView.TransformPointFromRoot(dropInsertionPoint.SceneElement, point);

            this.ToolBehaviorContext.SnappingEngine.Stop();
            SafeDataObject safeDataObject = new SafeDataObject(args.Data);

            using (TemporaryCursor.SetWaitCursor())
            {
                if (safeDataObject.GetDataPresent(DataFormats.FileDrop))
                {
                    FileDropToolBehavior.AddItemsToDocument(this.ActiveView, this.ActiveSceneViewModel.DesignerContext.ActiveProject.AddItems(Enumerable.Select <string, DocumentCreationInfo>((IEnumerable <string>) this.dropUtility.GetSupportedFiles(args.Data), (Func <string, DocumentCreationInfo>)(file => new DocumentCreationInfo()
                    {
                        SourcePath = file
                    }))), dropPoint, dropInsertionPoint);
                }
                else if (safeDataObject.GetDataPresent("BlendProjectItem"))
                {
                    ItemSelectionSet itemSelectionSet = (ItemSelectionSet)safeDataObject.GetData("BlendProjectItem");
                    using (SceneEditTransaction editTransaction = this.ActiveSceneViewModel.CreateEditTransaction(StringTable.DropProjectItemIntoSceneUndo))
                    {
                        foreach (IProjectItem projectItem in itemSelectionSet.Selection)
                        {
                            FileDropToolBehavior.AddToDocument(this.ActiveView, projectItem, dropPoint, dropInsertionPoint);
                        }
                        editTransaction.Commit();
                    }
                }
            }
            if (!this.IsSuspended)
            {
                this.PopSelf();
            }
            return(true);
        }
コード例 #19
0
        public static IProjectItem PromptAndCreateDesignData(SceneViewModel viewModel)
        {
            DesignObjectDataSourceDialog dataSourceDialog = new DesignObjectDataSourceDialog(viewModel.DataPanelModel);
            bool?nullable = dataSourceDialog.ShowDialog();

            if (nullable.HasValue)
            {
                if (nullable.Value)
                {
                    try
                    {
                        using (TemporaryCursor.SetWaitCursor())
                            return(DesignDataHelper.CreateDesignDataFile(dataSourceDialog.ObjectType, dataSourceDialog.DataSourceName.Trim(), viewModel.ProjectContext, false));
                    }
                    catch (Exception ex)
                    {
                        viewModel.DesignerContext.MessageDisplayService.ShowError(ex.Message);
                    }
                }
            }
            return((IProjectItem)null);
        }
コード例 #20
0
        public static bool Drop(DataBindingDragDropModel dragModel, Point artboardSnappedDropPoint)
        {
            if (DataBindingDragDropManager.targetHandler == null)
            {
                return(false);
            }
            bool flag = false;

            try
            {
                using (TemporaryCursor.SetWaitCursor())
                {
                    using (dragModel.ViewModel.AnimationEditor.DeferKeyFraming())
                    {
                        using (DataBindingDragDropManager.targetHandler.InitDragModel(dragModel))
                            flag = DataBindingDragDropManager.targetHandler.Handle(artboardSnappedDropPoint);
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(flag);
        }
コード例 #21
0
 public override SceneNode CreateInstance(ITypeId instanceType, ISceneInsertionPoint insertionPoint, Rect rect, OnCreateInstanceAction action)
 {
     using (!this.provider.IsLocal ? TemporaryCursor.SetWaitCursor() : (IDisposable)null)
         return(base.CreateInstance(instanceType, insertionPoint, rect, action));
 }
コード例 #22
0
        internal UpgradeWizard.UpgradeResponse PromptToUpgrade(Dictionary <ConversionType, ConversionType> conversionMapping, out bool?doNotShowAgain, ref string backupLocation, out IEnumerable <UpgradeAction> proposedUpgrades)
        {
            doNotShowAgain   = null;
            proposedUpgrades = Enumerable.Empty <UpgradeAction>();
            List <UpgradeAction> list = this.GetProposedUpgrades(conversionMapping).ToList <UpgradeAction>();

            if (list.Count == 0)
            {
                return(UpgradeWizard.UpgradeResponse.DontUpgrade);
            }
            List <ConversionType> conversionTypes  = new List <ConversionType>();
            List <ConversionType> conversionTypes1 = new List <ConversionType>();
            bool flag  = false;
            bool flag1 = false;

            if (!this.sketchFlowSolution)
            {
                using (IEnumerator <ConversionTarget> enumerator = this.GetConversionTargets().GetEnumerator())
                {
                    do
                    {
Label0:
                        if (!enumerator.MoveNext())
                        {
                            break;
                        }
                        ConversionTarget current             = enumerator.Current;
                        FrameworkName    targetFrameworkName = ProjectStoreHelper.GetTargetFrameworkName(current.ProjectStore);
                        if (targetFrameworkName == null || targetFrameworkName.Version == CommonVersions.Version4_0)
                        {
                            goto Label0;
                        }
                        else if (flag || !ProjectStoreHelper.UsesSilverlight(current.ProjectStore) || targetFrameworkName.Version.Major <= 1)
                        {
                            if (flag1 || !ProjectStoreHelper.UsesWpf(current.ProjectStore) || !(targetFrameworkName.Version >= CommonVersions.Version3_0))
                            {
                                continue;
                            }
                            flag1 = true;
                        }
                        else
                        {
                            flag = true;
                        }
                    }while (!flag1 || !flag);
                }
                if (flag1)
                {
                    conversionTypes1.Add(ConversionType.ProjectWpf35);
                    conversionTypes1.Add(ConversionType.ProjectWpf40);
                }
                if (flag)
                {
                    conversionTypes.Add(ConversionType.ProjectSilverlight3);
                    conversionTypes.Add(ConversionType.ProjectSilverlight4);
                }
            }
            bool flag2 = this.targetStore != null;
            bool flag3 = !flag2;
            bool flag4 = !flag2;
            UpgradeProjectDialog upgradeProjectDialog = new UpgradeProjectDialog(base.Services.ExpressionInformationService(), conversionTypes, conversionTypes1, flag3, flag4);
            ProjectDialogResult  projectDialogResult  = upgradeProjectDialog.ShowProjectDialog();

            doNotShowAgain = new bool?(upgradeProjectDialog.DoNotShowAgain);
            if (upgradeProjectDialog.Backup && projectDialogResult == ProjectDialogResult.Yes)
            {
                string      parentDirectory              = Microsoft.Expression.Framework.Documents.PathHelper.GetParentDirectory(Microsoft.Expression.Framework.Documents.PathHelper.GetDirectory(base.Solution.DocumentReference.Path));
                CultureInfo invariantCulture             = CultureInfo.InvariantCulture;
                string      newNameCopyTemplate          = StringTable.NewNameCopyTemplate;
                object[]    fileNameWithoutExtension     = new object[] { Path.GetFileNameWithoutExtension(base.Solution.DocumentReference.DisplayName) };
                string      availableFileOrDirectoryName = string.Format(invariantCulture, newNameCopyTemplate, fileNameWithoutExtension);
                availableFileOrDirectoryName = Microsoft.Expression.Framework.Documents.PathHelper.GetAvailableFileOrDirectoryName(availableFileOrDirectoryName, null, parentDirectory, false);
                backupLocation = Path.Combine(parentDirectory, availableFileOrDirectoryName);
                string    str        = backupLocation;
                Exception exception1 = null;
                using (IDisposable disposable = TemporaryCursor.SetWaitCursor())
                {
                    ErrorHandling.HandleBasicExceptions(() => ProjectManager.CopyDirectory(Microsoft.Expression.Framework.Documents.PathHelper.GetDirectory(this.Solution.DocumentReference.Path), str), (Exception exception) => exception1 = exception);
                }
                if (exception1 != null)
                {
                    ErrorArgs errorArg = new ErrorArgs()
                    {
                        Message      = StringTable.UpgradeBackupFailed,
                        Exception    = exception1,
                        AutomationId = "BackupProjectErrorDialog"
                    };
                    base.Services.MessageDisplayService().ShowError(errorArg);
                    return(UpgradeWizard.UpgradeResponse.Cancel);
                }
            }
            switch (projectDialogResult)
            {
            case ProjectDialogResult.Yes:
            {
                if (this.sketchFlowSolution)
                {
                    proposedUpgrades = list;
                }
                else
                {
                    this.VersionMapping[ConversionType.ProjectSilverlight2] = upgradeProjectDialog.SelectedSilverlightVersion;
                    this.VersionMapping[ConversionType.ProjectSilverlight3] = upgradeProjectDialog.SelectedSilverlightVersion;
                    this.VersionMapping[ConversionType.ProjectWpf30]        = upgradeProjectDialog.SelectedDotNetVersion;
                    this.VersionMapping[ConversionType.ProjectWpf35]        = upgradeProjectDialog.SelectedDotNetVersion;
                    proposedUpgrades = this.GetProposedUpgrades(conversionMapping);
                }
                return(UpgradeWizard.UpgradeResponse.Upgrade);
            }

            case ProjectDialogResult.No:
            {
                return(UpgradeWizard.UpgradeResponse.DontUpgrade);
            }
            }
            return(UpgradeWizard.UpgradeResponse.Cancel);
        }
コード例 #23
0
        private void Find(object sender, RoutedEventArgs e)
        {
            using (TemporaryCursor.SetWaitCursor())
            {
                this.searchResults.Clear();
                FindInFilesDialog.LookIn lookInValue = this.GetLookInValue();
                if (this.FindString == null || this.FindString.Trim().Length <= 0)
                {
                    return;
                }
                ISolution currentSolution = this.projectManager.CurrentSolution;
                if (currentSolution == null)
                {
                    return;
                }
                switch (lookInValue)
                {
                case FindInFilesDialog.LookIn.Solution:
                    using (IEnumerator <IProject> enumerator = currentSolution.Projects.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            this.FindInProject(enumerator.Current);
                        }
                        break;
                    }

                case FindInFilesDialog.LookIn.Project:
                    DocumentView documentView1 = this.viewService.ActiveView as DocumentView;
                    IProject     project1      = documentView1 == null?EnumerableExtensions.SingleOrNull <IProject>(this.projectManager.ItemSelectionSet.SelectedProjects) : currentSolution.FindProjectContainingOpenItem(documentView1.Document.DocumentReference);

                    if (project1 == null)
                    {
                        break;
                    }
                    this.FindInProject(project1);
                    break;

                case FindInFilesDialog.LookIn.OpenDocuments:
                    using (IEnumerator <IView> enumerator = this.viewService.Views.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            DocumentView documentView2 = enumerator.Current as DocumentView;
                            if (documentView2 != null)
                            {
                                this.FindInFile(currentSolution.FindProjectContainingOpenItem(documentView2.Document.DocumentReference).FindItem(documentView2.Document.DocumentReference), new FindInFilesDialog.ProcessResult(this.SaveResult), (FindInFilesResult)null);
                            }
                        }
                        break;
                    }

                case FindInFilesDialog.LookIn.CurrentDocument:
                    DocumentView documentView3 = this.viewService.ActiveView as DocumentView;
                    if (documentView3 != null)
                    {
                        this.FindInFile(currentSolution.FindProjectContainingOpenItem(documentView3.Document.DocumentReference).FindItem(documentView3.Document.DocumentReference), new FindInFilesDialog.ProcessResult(this.SaveResult), (FindInFilesResult)null);
                        break;
                    }
                    IProject      project2     = EnumerableExtensions.SingleOrNull <IProject>(this.projectManager.ItemSelectionSet.SelectedProjects);
                    IDocumentItem documentItem = EnumerableExtensions.SingleOrNull <IDocumentItem>(this.projectManager.ItemSelectionSet.Selection);
                    if (project2 == null || documentItem == null)
                    {
                        break;
                    }
                    this.FindInFile(project2.FindItem(documentItem.DocumentReference), new FindInFilesDialog.ProcessResult(this.SaveResult), (FindInFilesResult)null);
                    break;
                }
            }
        }
コード例 #24
0
ファイル: WelcomeScreen.cs プロジェクト: radtek/Shopdrawing
 private void SamplesListBox_ItemActivate(object source, EventArgs e)
 {
     using (TemporaryCursor.SetWaitCursor())
         this.OpenSampleCommandCore();
 }