예제 #1
0
        public override object EditValue(
            ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            DataSourceProviderService dspService =
                (DataSourceProviderService)provider.GetService(typeof(DataSourceProviderService));

            if (dspService == null || !dspService.SupportsAddNewDataSource)
            {
                using (GetTypeDialog dlg = new GetTypeDialog(provider, typeof(object), FilterTypeList))
                {
                    IWin32Window dialogOwnerWindow = null;
                    IUIService   uiService         = (IUIService)provider.GetService(typeof(IUIService));

                    if (uiService != null)
                    {
                        dialogOwnerWindow = uiService.GetDialogOwnerWindow();
                    }

                    DialogResult result = dlg.ShowDialog(dialogOwnerWindow);

                    return(result == DialogResult.OK && dlg.ResultType != null? dlg.ResultType: value);
                }
            }

            return(new TypePicker().PickType(provider, value as Type, FilterTypeList));
        }
예제 #2
0
        private void addNewLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            GetTypeDialog dlg = new GetTypeDialog(_serviceProvider, typeof(object), _filter);

            DialogResult result = dlg.ShowDialog();

            if (result == DialogResult.OK && dlg.ResultType != null)
            {
                _resultType = dlg.ResultType;

                SaveType(_resultType);

                _windowsFormsEditorService.CloseDropDown();
            }
        }
예제 #3
0
        public override object EditValue(
            ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            DataSourceProviderService dspService =
                (DataSourceProviderService)provider.GetService(typeof(DataSourceProviderService));

            if (dspService == null || !dspService.SupportsAddNewDataSource)
            {
                GetTypeDialog dlg = new GetTypeDialog(provider, typeof(object), FilterTypeList);

                DialogResult result = dlg.ShowDialog();

                return(result == DialogResult.OK && dlg.ResultType != null?
                       dlg.ResultType: value);
            }

            return(new TypePicker().PickType(provider, value as Type, FilterTypeList));
        }
예제 #4
0
        private void addNewLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            using (GetTypeDialog dlg = new GetTypeDialog(_serviceProvider, typeof(object), _filter))
            {
                IUIService   uiService = GetService <IUIService>();
                IWin32Window owner     = uiService == null? null: uiService.GetDialogOwnerWindow();
                DialogResult result    = dlg.ShowDialog(owner);

                if (result == DialogResult.OK && dlg.ResultType != null)
                {
                    _resultType = dlg.ResultType;

                    SaveType(_resultType);

                    _windowsFormsEditorService.CloseDropDown();
                }
            }
        }
예제 #5
0
		public override object EditValue(
			ITypeDescriptorContext context, IServiceProvider provider, object value)
		{
			DataSourceProviderService dspService =
				(DataSourceProviderService)provider.GetService(typeof(DataSourceProviderService));

			if (dspService == null || !dspService.SupportsAddNewDataSource)
			{
				using (GetTypeDialog dlg = new GetTypeDialog(provider, typeof (object), FilterTypeList))
				{
					IWin32Window dialogOwnerWindow = null;
					IUIService   uiService         = (IUIService)provider.GetService(typeof(IUIService));

					if (uiService != null)
						dialogOwnerWindow = uiService.GetDialogOwnerWindow();

					DialogResult result = dlg.ShowDialog(dialogOwnerWindow);

					return result == DialogResult.OK && dlg.ResultType != null? dlg.ResultType: value;
				}
			}

			return new TypePicker().PickType(provider, value as Type, FilterTypeList);
		}