Пример #1
0
 public NewProjectDialog(string automationId, IExpressionInformationService expressionInformationService)
 {
     base.Title           = expressionInformationService.DefaultDialogTitle;
     this.ApplicationName = expressionInformationService.ShortApplicationName;
     base.SizeToContent   = System.Windows.SizeToContent.WidthAndHeight;
     base.SetValue(AutomationElement.IdProperty, automationId);
 }
Пример #2
0
        public void Process(IExpressionInformationService expressionInformationService)
        {
            bool flag = false;

            if ((this.ProcessingMode & ChangeProcessingModes.NoUI) == (ChangeProcessingModes)0)
            {
                try
                {
                    flag = Dialog.ActiveModalWindow.Visibility == Visibility.Visible;
                }
                catch (Exception ex)
                {
                }
            }
            if (flag)
            {
                new AsyncProcessDialog((AsyncProcess)this, expressionInformationService).ShowDialog();
            }
            else
            {
                this.Reset();
                while (this.MoveNext() && !this.IsKilled)
                {
                    this.Work();
                }
            }
        }
Пример #3
0
        public string FindAvailableDefaultName(string targetFolder, IExpressionInformationService expressionInformationService)
        {
            string str           = string.Concat(Path.GetFileNameWithoutExtension(this.DefaultName), "{0}");
            string safeExtension = Microsoft.Expression.Framework.Documents.PathHelper.GetSafeExtension(this.DefaultName);

            targetFolder = Microsoft.Expression.Framework.Documents.PathHelper.EnsurePathEndsInDirectorySeparator(targetFolder);
            IEnumerable <TemplateArgument> defaultArguments = TemplateManager.GetDefaultArguments(expressionInformationService);

            TemplateArgument[] templateArgument = new TemplateArgument[] { new TemplateArgument("fileinputname", str), new TemplateArgument("fileinputextension", safeExtension) };
            defaultArguments = defaultArguments.Concat <TemplateArgument>(templateArgument);
            List <string> strs = new List <string>();

            foreach (VSTemplateTemplateContentProjectItem templateProjectItem in this.TemplateProjectItems)
            {
                if (string.IsNullOrEmpty(templateProjectItem.TargetFileName) || !templateProjectItem.TargetFileName.Contains("$fileinputname$"))
                {
                    continue;
                }
                strs.Add(string.Concat(targetFolder, TemplateParser.ReplaceTemplateArguments(templateProjectItem.TargetFileName, defaultArguments)));
            }
            if (strs.Count == 0)
            {
                return(this.DefaultName);
            }
            string      str1             = Microsoft.Expression.Framework.Documents.PathHelper.FindAvailablePaths(strs, true);
            CultureInfo invariantCulture = CultureInfo.InvariantCulture;

            object[] objArray = new object[] { str1 };
            return(string.Concat(string.Format(invariantCulture, str, objArray), safeExtension));
        }
Пример #4
0
 public SampleDataCollection(ProjectContext projectContext, IMSBuildProject msBuildProject, IExpressionInformationService expressionInformationService)
 {
     this.projectContext = projectContext;
     this.msBuildProject = msBuildProject;
     this.expressionInformationService = expressionInformationService;
     this.sampleDataClrNamespacePrefix = DataSetContext.GetClrNamespacePrefix(DataSetType.SampleDataSet, this.projectContext.RootNamespace);
     this.dataStoreClrNamespacePrefix  = DataSetContext.GetClrNamespacePrefix(DataSetType.DataStoreSet, this.projectContext.RootNamespace);
 }
Пример #5
0
 internal static void SetApplicationInformation(IExpressionInformationService expressionInformationService)
 {
     LowMemoryMessage.messageTitle = expressionInformationService.DefaultDialogTitle;
     LowMemoryMessage.errorMessage = string.Format((IFormatProvider)CultureInfo.CurrentCulture, StringTable.MemoryLowErrorMessage, new object[1]
     {
         (object)expressionInformationService.ShortApplicationName
     });
 }
Пример #6
0
 protected SourceControlProcess(SourceControlProcessModel model, IServiceProvider serviceProvider)
     : base((IAsyncMechanism) new CurrentDispatcherAsyncMechanism(DispatcherPriority.Background))
 {
     this.Model        = model;
     this.StillWorking = true;
     this.expressionInformationService = serviceProvider.GetService(typeof(IExpressionInformationService)) as IExpressionInformationService;
     this.displayService       = serviceProvider.GetService(typeof(IMessageDisplayService)) as IMessageDisplayService;
     this.sourceControlService = serviceProvider.GetService(typeof(ISourceControlService)) as SourceControlService;
 }
Пример #7
0
 public AddHandlerImplementation(IExpressionInformationService expressionInformationService, ITypeDeclaration classModel, Type returnType, string methodName, IEnumerable <IParameterDeclaration> parameters)
 {
     this.expressionInformationService = expressionInformationService;
     this.classModel = classModel;
     this.returnType = returnType;
     this.methodName = methodName;
     this.parameters = parameters;
     this.thread     = new Thread(new ThreadStart(this.ThreadExecute));
     this.thread.SetApartmentState(ApartmentState.STA);
 }
Пример #8
0
        private string GetPathFromRegistry(string blendValueName, string defaultKey, string defaultValueName)
        {
            string str = string.Empty;
            IExpressionInformationService informationService = (IExpressionInformationService)this.serviceProvider.GetService(typeof(IExpressionInformationService));

            if (informationService != null)
            {
                str = RegistryHelper.RetrieveRegistryValue <string>(Registry.LocalMachine, informationService.VersionedRegistryPath, blendValueName);
            }
            if (string.IsNullOrEmpty(str))
            {
                str = RegistryHelper.RetrieveRegistryValue <string>(Registry.LocalMachine, defaultKey, defaultValueName);
            }
            return(str);
        }
Пример #9
0
 public OverwriteFilesDialog(IEnumerable <string> fileList, bool allowOverwrite, IExpressionInformationService expressionInformationService)
 {
     this.expressionInformationService = expressionInformationService;
     this.allowOverwrite = allowOverwrite;
     if (!this.allowOverwrite)
     {
         this.labelText        = StringTable.OverwriteFilesDialogCannotContinueMessage;
         this.acceptButtonText = StringTable.AcceptButtonOkText;
     }
     else
     {
         this.labelText        = StringTable.OverwriteFilesDialogContinueMessage;
         this.acceptButtonText = StringTable.AcceptButtonYesText;
     }
     this.fileList = (
         from file in fileList
         select PathHelper.GetFileOrDirectoryName(file)).ToList <string>();
     base.SetValue(AutomationElement.IdProperty, "OverwriteFilesYesNoDialog");
 }
Пример #10
0
        public AboutDialog(IServices services, string pid)
        {
            this.services = services;
            this.expressionInformationService = services.GetService <IExpressionInformationService>();
            ILicenseService service = services.GetService <ILicenseService>();

            this.DialogContent = (UIElement)FileTable.GetElement("Resources\\AboutDialog.xaml");
            ResourceDictionary aboutDialogResources = service.AboutDialogResources;

            if (aboutDialogResources != null)
            {
                this.Resources.MergedDictionaries.Add(aboutDialogResources);
            }
            this.Title              = this.Resources[(object)"AboutDialogTitle"] as string;
            this.WindowStyle        = WindowStyle.None;
            this.AllowsTransparency = true;
            this.Background         = (Brush) new SolidColorBrush(Colors.Transparent);
            ((Hyperlink)LogicalTreeHelper.FindLogicalNode((DependencyObject)this.DialogContent, "WebPageLink")).Click += new RoutedEventHandler(this.Hyperlink_Click);
            TextBlock textBlock1 = (TextBlock)LogicalTreeHelper.FindLogicalNode((DependencyObject)this.DialogContent, "ProductKey");
            TextBlock textBlock2 = (TextBlock)LogicalTreeHelper.FindLogicalNode((DependencyObject)this.DialogContent, "LicensingStatus");

            ((TextBlock)LogicalTreeHelper.FindLogicalNode((DependencyObject)this.DialogContent, "PerformanceLevel")).Text = this.RenderPerformanceLevelAsString;
            if (!string.IsNullOrEmpty(pid))
            {
                textBlock1.Text = pid;
            }
            else if (!string.IsNullOrEmpty(service.MostPermissivePid))
            {
                textBlock1.Text = service.MostPermissivePid;
            }
            textBlock2.Text = this.GetLicensingStatusText(service);
            if (string.IsNullOrEmpty(textBlock2.Text))
            {
                int num = (int)this.services.GetService <IMessageDisplayService>().ShowMessage(new MessageBoxArgs()
                {
                    Message = StringTable.UnableToAccessLicensingInformation,
                    Button  = MessageBoxButton.OK,
                    Image   = MessageBoxImage.Hand
                });
            }
            this.SizeToContent = SizeToContent.WidthAndHeight;
            this.DataContext   = (object)this;
        }
Пример #11
0
        public void StartAsyncProcess(IExpressionInformationService expressionInformationService, Action <object, DoWorkEventArgs> workerDelegate, EventHandler onBegun, EventHandler onComplete, EventHandler onProgress, EventHandler onKill)
        {
            AsyncExecuteCommandProcess executeCommandProcess = new AsyncExecuteCommandProcess(string.Empty, workerDelegate);

            executeCommandProcess.Begun    += onBegun;
            executeCommandProcess.Killed   += onKill;
            executeCommandProcess.Complete += onComplete;
            executeCommandProcess.Progress += onProgress;
            executeCommandProcess.Progress += new EventHandler(this.OnProgress);
            executeCommandProcess.Killed   += new EventHandler(this.OnKill);
            executeCommandProcess.Complete += new EventHandler(this.OnComplete);
            this.processingQueue.Add((AsyncProcess)executeCommandProcess, false);
            if (this.asyncProgressDialog != null)
            {
                return;
            }
            this.asyncProgressDialog = new AsyncProcessDialog((AsyncProcess)this.processingQueue, expressionInformationService, 0.0);
            this.ShowProgressDialog(true);
            this.CleanUp((AsyncExecuteCommandProcess)null);
            this.asyncProgressDialog = (AsyncProcessDialog)null;
        }
Пример #12
0
        public static IEnumerable <TemplateArgument> GetDefaultArguments(IExpressionInformationService expressionInformationService)
        {
            List <TemplateArgument> templateArguments = new List <TemplateArgument>(22);
            DateTime now = DateTime.Now;

            templateArguments.Add(new TemplateArgument("time", now.ToString(CultureInfo.CurrentUICulture)));
            int year = DateTime.Now.Year;

            templateArguments.Add(new TemplateArgument("year", year.ToString(CultureInfo.CurrentUICulture)));
            templateArguments.Add(new TemplateArgument("clrversion", Environment.Version.ToString()));
            templateArguments.Add(new TemplateArgument("machinename", Environment.MachineName));
            templateArguments.Add(new TemplateArgument("userdomain", Environment.UserDomainName));
            templateArguments.Add(new TemplateArgument("username", Environment.UserName));
            templateArguments.Add(new TemplateArgument("expressionblendversion", (expressionInformationService == null ? "0.0.0.0" : expressionInformationService.Version.ToString())));
            List <TemplateArgument> templateArguments1 = templateArguments;

            for (int i = 1; i <= 10; i++)
            {
                Guid        guid             = Guid.NewGuid();
                CultureInfo invariantCulture = CultureInfo.InvariantCulture;
                object[]    objArray         = new object[] { i };
                templateArguments1.Add(new TemplateArgument(string.Format(invariantCulture, "guid{0}", objArray), guid.ToString("D")));
            }
            string str = RegistryHelper.RetrieveRegistryValue <string>(Registry.LocalMachine, "Software\\Microsoft\\Windows NT\\CurrentVersion", "RegisteredOrganization");

            if (!string.IsNullOrEmpty(str))
            {
                templateArguments1.Add(new TemplateArgument("registeredorganization", str));
            }
            string str1 = RegistryHelper.RetrieveRegistryValue <string>(Registry.LocalMachine, "Software\\Microsoft\\Microsoft SDKs\\Silverlight\\v3.0\\ReferenceAssemblies", "SLRuntimeInstallVersion") ?? "0.0.0.0";
            string str2 = RegistryHelper.RetrieveRegistryValue <string>(Registry.LocalMachine, "Software\\Microsoft\\Microsoft SDKs\\Silverlight\\v4.0\\ReferenceAssemblies", "SLRuntimeInstallVersion") ?? "0.0.0.0";

            templateArguments1.Add(new TemplateArgument("silverlight3sdkversion", str1));
            templateArguments1.Add(new TemplateArgument("silverlight4sdkversion", str2));
            return(templateArguments1);
        }
Пример #13
0
 public UpgradeProjectDialog(IExpressionInformationService expressionInformationService, List <ConversionType> silverlightVersions, List <ConversionType> dotNetVersions, bool showDoNotShowAgainOption, bool showBackupOption) : base("UpgradeProjectDialog", expressionInformationService)
 {
     this.InitializeComponent();
     if (silverlightVersions != null)
     {
         this.SilverlightVersions = silverlightVersions;
     }
     else
     {
         this.SilverlightVersions = new List <ConversionType>();
     }
     if (dotNetVersions != null)
     {
         this.DotNetVersions = dotNetVersions;
     }
     else
     {
         this.DotNetVersions = new List <ConversionType>();
     }
     this.DotNetVersionComboBox.SelectedIndex      = 0;
     this.SilverlightVersionComboBox.SelectedIndex = 0;
     this.ShowBackupOption         = showBackupOption;
     this.ShowDoNotShowAgainOption = showDoNotShowAgainOption;
 }
Пример #14
0
        public static bool RemoveDesignData(IProjectItem designDataFile, IProjectContext projectContext, IExpressionInformationService service)
        {
            IProject project = (IProject)projectContext.GetService(typeof(IProject));
            string   path    = designDataFile.DocumentReference.Path;

            if (!project.RemoveItems(1 != 0, designDataFile))
            {
                return(false);
            }
            new DesignDataRemovalProcessor((IAsyncMechanism) new CurrentDispatcherAsyncMechanism(DispatcherPriority.Background), path, projectContext, ChangeProcessingModes.CollectChanges | ChangeProcessingModes.ApplyChanges).Process(service);
            return(true);
        }
Пример #15
0
 public AsyncProcessDialog(AsyncProcess asyncProcess, IExpressionInformationService expressionInformationService)
     : this(asyncProcess, expressionInformationService.DefaultDialogTitle)
 {
 }
Пример #16
0
 public MessageDisplayService(IExpressionInformationService expressionInformationService)
 {
     this.defaultCaption = expressionInformationService.DefaultDialogTitle;
 }
Пример #17
0
 public AsyncProcessDialog(AsyncProcess asyncProcess, IExpressionInformationService expressionInformationService, double showAfter)
     : this(asyncProcess, expressionInformationService.DefaultDialogTitle, showAfter)
 {
 }