コード例 #1
0
        public IEnumerable <OpenWithFileViewer> GetFileViewers()
        {
            if (fileViewers != null)
            {
                return(fileViewers);
            }

            fileViewers = OpenWithFileViewer.GetFileViewers(fileName, mimeType, project).ToList();

            fileViewers.AddRange(OpenWithServices.Mappings.GetUserDefinedFileViewers(fileName, mimeType));

            ConfigureDefaultFileViewer();

            return(fileViewers);
        }
コード例 #2
0
        OpenWithFileViewer FindMappedFileViewer(
            FilePath fileName,
            KeyValuePair <DisplayBindingMappingKey, string> keyValuePair)
        {
            if (keyValuePair.Key.IsDisplayBinding)
            {
                var fileViewers = OpenWithFileViewer.GetFileViewers(
                    fileName,
                    keyValuePair.Key.MimeType,
                    null);

                return(fileViewers
                       .FirstOrDefault(fileViewer => fileViewer.GetMappingKey() == keyValuePair.Value));
            }

            // Application default mapping. This cannot be found at this point
            // until we have the full file name to an existing file. The application
            // will not be found so it has to be done later on.
            return(new LazyOpenWithFileViewer(keyValuePair.Key, keyValuePair.Value));
        }
コード例 #3
0
		void FindDisplayBinding (FilePath fileName, string mimeType, Project ownerProject)
		{
			findingDisplayBinding = true;

			try {
				string mappingKey = lazyFileViewer.GetMappingKey ();

				var fileViewer = OpenWithFileViewer.GetFileViewers (
					fileName,
					mimeType,
					ownerProject).FirstOrDefault (item => item.GetMappingKey () == mappingKey);

				if (fileViewer != null) {
					displayBinding = DisplayBindingFactory.CreateDisplayBinding (
						fileName,
						mimeType,
						fileViewer) as IExternalDisplayBinding;
				}
			} finally {
				findingDisplayBinding = false;
			}
		}