public DisplayBindingDescriptor AddExternalProcessDisplayBinding(ExternalProcessDisplayBinding binding)
		{
			SD.MainThread.VerifyAccess();
			if (binding == null)
				throw new ArgumentNullException("binding");
			DisplayBindingDescriptor descriptor = AddExternalProcessDisplayBindingInternal(binding);
			SaveExternalProcessDisplayBindings();
			return descriptor;
		}
		DisplayBindingDescriptor AddExternalProcessDisplayBindingInternal(ExternalProcessDisplayBinding binding)
		{
			externalProcessDisplayBindings.Add(binding);
			DisplayBindingDescriptor descriptor = new DisplayBindingDescriptor(binding) {
				Id = binding.Id,
				Title = binding.Title
			};
			bindings.Add(descriptor);
			return descriptor;
		}
示例#3
0
        DisplayBindingDescriptor AddExternalProcessDisplayBindingInternal(ExternalProcessDisplayBinding binding)
        {
            externalProcessDisplayBindings.Add(binding);
            DisplayBindingDescriptor descriptor = new DisplayBindingDescriptor(binding)
            {
                Id    = binding.Id,
                Title = binding.Title
            };

            bindings.Add(descriptor);
            return(descriptor);
        }
示例#4
0
        public DisplayBindingDescriptor AddExternalProcessDisplayBinding(ExternalProcessDisplayBinding binding)
        {
            SD.MainThread.VerifyAccess();
            if (binding == null)
            {
                throw new ArgumentNullException("binding");
            }
            DisplayBindingDescriptor descriptor = AddExternalProcessDisplayBindingInternal(binding);

            SaveExternalProcessDisplayBindings();
            return(descriptor);
        }
 public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
 {
     if (destinationType == typeof(string))
     {
         ExternalProcessDisplayBinding binding = (ExternalProcessDisplayBinding)value;
         return(binding.Id + "|" + binding.FileExtension + "|" + binding.Title + "|" + binding.CommandLine);
     }
     else
     {
         return(base.ConvertTo(context, culture, value, destinationType));
     }
 }
 void AddButtonClick(object sender, EventArgs e)
 {
     using (AddOpenWithEntryDialog dlg = new AddOpenWithEntryDialog()) {
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             ExternalProcessDisplayBinding binding = new ExternalProcessDisplayBinding {
                 FileExtension = fileExtension,
                 CommandLine   = dlg.ProgramName,
                 Title         = dlg.DisplayName,
                 Id            = Guid.NewGuid().ToString()
             };
             programListBox.Items.Add(new ListEntry(SD.DisplayBindingService.AddExternalProcessDisplayBinding(binding), false));
         }
     }
 }
		public void RemoveExternalProcessDisplayBinding(ExternalProcessDisplayBinding binding)
		{
			SD.MainThread.VerifyAccess();
			if (binding == null)
				throw new ArgumentNullException("binding");
			if (!externalProcessDisplayBindings.Remove(binding))
				throw new ArgumentException("binding was not added");
			SaveExternalProcessDisplayBindings();
			for (int i = 0; i < bindings.Count; i++) {
				if (bindings[i].GetLoadedBinding() == binding) {
					bindings.RemoveAt(i);
					return;
				}
			}
			throw new InvalidOperationException("did not find binding descriptor even though binding was registered");
		}
示例#8
0
 public void RemoveExternalProcessDisplayBinding(ExternalProcessDisplayBinding binding)
 {
     SD.MainThread.VerifyAccess();
     if (binding == null)
     {
         throw new ArgumentNullException("binding");
     }
     if (!externalProcessDisplayBindings.Remove(binding))
     {
         throw new ArgumentException("binding was not added");
     }
     SaveExternalProcessDisplayBindings();
     for (int i = 0; i < bindings.Count; i++)
     {
         if (bindings[i].GetLoadedBinding() == binding)
         {
             bindings.RemoveAt(i);
             return;
         }
     }
     throw new InvalidOperationException("did not find binding descriptor even though binding was registered");
 }
示例#9
0
		void AddButtonClick(object sender, EventArgs e)
		{
			using (AddOpenWithEntryDialog dlg = new AddOpenWithEntryDialog()) {
				if (dlg.ShowDialog(this) == DialogResult.OK) {
					ExternalProcessDisplayBinding binding = new ExternalProcessDisplayBinding {
						FileExtension = fileExtension,
						CommandLine = dlg.ProgramName,
						Title = dlg.DisplayName,
						Id = Guid.NewGuid().ToString()
					};
					programListBox.Items.Add(new ListEntry(SD.DisplayBindingService.AddExternalProcessDisplayBinding(binding), false));
				}
			}
		}