Esempio n. 1
1
        public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            if (context != null && provider != null)
            {
                edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                if (edSvc != null)
                {
                    lb = new ListBox();
                    lb.Items.AddRange(new object[] {
                        "Sunday",
                        "Monday",
                        "Tuesday",
                        "Wednesday",
                        "Thursday",
                        "Friday",
                        "Saturday"});
                    lb.SelectedIndexChanged += new System.EventHandler(lb_SelectedIndexChanged);
                    edSvc.DropDownControl(lb);
                }
                return text;

            }

            return base.EditValue(context, provider, value);
        }
Esempio n. 2
0
        public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            List<string> objName = new List<string>();
            ControlCollection ctrlList = null;
            if (context.Instance is Control)
            {
                ctrlList = ((Control)context.Instance).Page.Controls;
            }
            else if (context.Instance is InfoOwnerCollectionItem && ((InfoOwnerCollectionItem)context.Instance).Owner is Control)
            {
                ctrlList = ((Control)((InfoOwnerCollectionItem)context.Instance).Owner).Page.Controls;
            }

            foreach (Control ctrl in ctrlList)
            {
                if (ctrl is WebDataSource)
                {
                    objName.Add(ctrl.ID);
                }
            }
            IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (service != null)
            {
                StringListSelector selector = new StringListSelector(service, objName.ToArray());
                string strValue = (string)value;
                if (selector.Execute(ref strValue)) value = strValue;
            }
            return value;
        }
        /// <summary>
        /// Get the current Hierarchy
        /// </summary>
        /// <param name="provider"></param>
        /// <returns></returns>
        public static IVsHierarchy GetCurrentHierarchy(System.IServiceProvider provider)
        {
            DTE vs = (DTE)provider.GetService(typeof(DTE));
            if (vs == null) throw new InvalidOperationException("DTE not found.");

            return ToHierarchy(vs.SelectedItems.Item(1).ProjectItem.ContainingProject);
        }
		public override object EditValue(
			System.ComponentModel.ITypeDescriptorContext context,
			System.IServiceProvider provider, object value)
		{

			if (provider != null)
			{
				IWindowsFormsEditorService editorService =
					provider.GetService(
					typeof(IWindowsFormsEditorService))
					as IWindowsFormsEditorService;


				if (editorService != null)
				{
					Progress ctrl = (Progress)context.Instance;
					ProgressValueDropDown selectionControl =
						new ProgressValueDropDown(
						(int)value, ctrl.Maximum,
						editorService);

					editorService.DropDownControl(selectionControl);

					value = selectionControl.Value;
				}
			}
			return value;

		}
Esempio n. 5
0
        // Displays the UI for value selection. 
        // Para ver en un User control edSvc.DropDownControl(styleControl);
        // Para ver en un formulario edSvc.ShowDialog(styleForm);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        /// <param name="provider"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {

            
            // Return the value if the value is not of type Int32, Double and Single.
            //if (value.GetType() != typeof(IFwkCellStyle))
            //    return value;

            // Uses the IWindowsFormsEditorService to display a 
            // drop-down UI in the Properties window.
            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (edSvc != null)
            {
                // Display an angle selection control and retrieve the value.
                //StyleControl styleControl = new StyleControl((GridProperties)value);
                //edSvc.DropDownControl(styleControl);
                FwkGridStyleForm wStyleForm = new FwkGridStyleForm((GridProperties)value);
                edSvc.ShowDialog(wStyleForm);
                // Return the value in the appropraite data format.
                //if (value.GetType() == typeof(IFwkCellStyle))
                return wStyleForm.GridProperties;
                
            }
            
            return value;

        }
Esempio n. 6
0
        public static Microsoft.VisualStudio.Text.Editor.IWpfTextView GetActiveTextView(System.IServiceProvider serviceProvider)
        {
            var monitorSelection = (Microsoft.VisualStudio.Shell.Interop.IVsMonitorSelection)serviceProvider.GetService(typeof(Microsoft.VisualStudio.Shell.Interop.SVsShellMonitorSelection));
            if (monitorSelection == null) {
                return null;
            }
            object curDocument;
            if (Microsoft.VisualStudio.ErrorHandler.Failed(monitorSelection.GetCurrentElementValue((uint)Microsoft.VisualStudio.VSConstants.VSSELELEMID.SEID_DocumentFrame, out curDocument))) {
                return null;
            }

            Microsoft.VisualStudio.Shell.Interop.IVsWindowFrame frame = curDocument as Microsoft.VisualStudio.Shell.Interop.IVsWindowFrame;
            if (frame == null) {
                return null;
            }

            object docView = null;
            if (Microsoft.VisualStudio.ErrorHandler.Failed(frame.GetProperty((int)Microsoft.VisualStudio.Shell.Interop.__VSFPROPID.VSFPROPID_DocView, out docView))) {
                return null;
            }

            if (docView is Microsoft.VisualStudio.TextManager.Interop.IVsCodeWindow) {
                Microsoft.VisualStudio.TextManager.Interop.IVsTextView textView;
                if (Microsoft.VisualStudio.ErrorHandler.Failed(((Microsoft.VisualStudio.TextManager.Interop.IVsCodeWindow)docView).GetPrimaryView(out textView))) {
                    return null;
                }

                var model = (Microsoft.VisualStudio.ComponentModelHost.IComponentModel)serviceProvider.GetService(typeof(Microsoft.VisualStudio.ComponentModelHost.SComponentModel));
                var adapterFactory = model.GetService<Microsoft.VisualStudio.Editor.IVsEditorAdaptersFactoryService>();
                var wpfTextView = adapterFactory.GetWpfTextView(textView);
                return wpfTextView;
            }
            return null;
        }
Esempio n. 7
0
        /// <summary>
        /// Called when we want to edit the value of a property.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="provider"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (edSvc != null)
            {
                UI.Actions.MessageAction messageAction = context.Instance as UI.Actions.MessageAction;
                if (messageAction != null)
                {
                    ListBox listBox = new ListBox();
                    foreach (UI.Message message in messageAction.Scene.Messages)
                    {
                        listBox.Items.Add(message);
                    }

                    listBox.SelectedItem = messageAction.Scene.GetMessage((int)value);
                    listBox.SelectedIndexChanged += ((s, e) => { edSvc.CloseDropDown(); });

                    edSvc.DropDownControl(listBox);

                    return listBox.SelectedItem != null ? (listBox.SelectedItem as UI.Message).ID : -1;
                }
            }

            return value;
        }
Esempio n. 8
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (service != null && context.Instance.GetType().GetInterface("IReportGetValues") != null)
            {
                IReportGetValues item = (IReportGetValues)context.Instance;
                ListBox listbox = new ListBox();
                listbox.Items.AddRange(item.GetValues(context.PropertyDescriptor.Name));
                listbox.SelectedItem = value;
                listbox.Click += delegate(object sender, EventArgs e)
                {
                    service.CloseDropDown();
                };
                service.DropDownControl(listbox);
                if (listbox.SelectedItem != null)
                {
                    value = listbox.SelectedItem.ToString();
                }
                else
                {
                    value = string.Empty;
                }
            }
            return value;
        }
Esempio n. 9
0
 public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
 {
     var service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
     try
     {
         //throw new MissingMethodException(
         ListBox listbox = new ListBox();
         listbox.Items.AddRange(GetListOfValues(context).ToArray());
         listbox.SelectedItem = value;
         listbox.Click += delegate(object sender, EventArgs e)
         {
             service.CloseDropDown();
         };
         service.DropDownControl(listbox);
         if (listbox.SelectedItem != null)
         {
             value = listbox.SelectedItem.ToString();
         }
         else
         {
             value = string.Empty;
         }
     }
     catch(Exception e)
     {
         System.Windows.Forms.MessageBox.Show(e.Message, "Error"
                , System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
     }
     return value;
 }
Esempio n. 10
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService editorService = null;
            if (provider != null)
            {
                editorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
            }

            if (editorService != null)
            {
                var control = new ListBox();
                control.Items.Add(ResourceExtenderBase.AnyText);
                control.Items.AddRange(list);
                control.Height = 200;
                control.BorderStyle = BorderStyle.FixedSingle;
                if (string.IsNullOrEmpty(value as string))
                {
                    control.SelectedIndex = 0;
                }
                else
                {
                    control.SelectedItem = value;
                }
                control.PreviewKeyDown += (s, x) => { if (x.KeyCode == Keys.Enter) editorService.CloseDropDown(); };
                control.Leave += (s, x) => editorService.CloseDropDown();
                control.Click += (s, x) => editorService.CloseDropDown();

                editorService.DropDownControl(control);

                if (control.SelectedIndex == 0)
                    return null;
                return control.SelectedItem;
            }
            return base.EditValue(context, provider, value);
        }
Esempio n. 11
0
        /// <summary>
        /// Called when we want to edit the value of the property.  Brings up the a drop down list box of masks.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="provider"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (edSvc != null)
            {
                GUIControl controlContext = context.Instance as GUIControl;

                ListBox listBox = new ListBox();
                listBox.Items.Add("None");
                AddControls(listBox, controlContext.ParentView.Controls);

                listBox.SelectedItem = value;
                listBox.SelectedIndexChanged += (s, e) => { edSvc.CloseDropDown(); };

                edSvc.DropDownControl(listBox);

                //no valid item selected; return previous value
                if (listBox.SelectedIndex == -1 || listBox.SelectedItem == null)
                    return value;

                //"None" selected
                if (listBox.SelectedIndex == 0)
                    return -1;

                return (listBox.SelectedItem as GUIMask).ID;
            }

            return value;
        }
Esempio n. 12
0
        public VsIdleTaskHost(System.IServiceProvider serviceProvider, Func<bool> task, TimeSpan updateDelay)
        {
            Guard.NotNull(() => serviceProvider, serviceProvider);
            Guard.NotNull(() => task, task);

            this.componentManager = (IOleComponentManager)serviceProvider.GetService(typeof(SOleComponentManager));
            this.host = new HostComponent(task, updateDelay);
        }
        /// <summary>
        /// Returns a collection of standard values for the data type this type converter is designed for when provided with a format context.
        /// </summary>
        /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"></see> that provides a format context that can be used to extract additional information about the environment from which this converter is invoked. This parameter or properties of this parameter can be null.</param>
        /// <returns>
        /// A <see cref="T:System.ComponentModel.TypeConverter.StandardValuesCollection"></see> that holds a standard set of valid values, or null if the data type does not support a standard set of values.
        /// </returns>
        public override StandardValuesCollection GetStandardValues(System.ComponentModel.ITypeDescriptorContext context)
        {
            DTE dte = (DTE)context.GetService(typeof(DTE));
            ResponsibleProjectFinder finder = new ResponsibleProjectFinder(dte);
            List<Project> projects = finder.FindProjectsWithResponsibility(responsibility);

            return new StandardValuesCollection(projects);
        }
 public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
 {
     IWindowsFormsEditorService svc = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
     if (svc != null) {
         using (TextMessageEditorForm form = new TextMessageEditorForm()) {
             form.MessageText = (string) value;
             if (svc.ShowDialog(form) == DialogResult.OK)
                 value = form.MessageText;
         }
     }
     return value;
 }
Esempio n. 15
0
 public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
 {
     List<string> objName = new List<string>();
     IAjaxDataSource ajaxSource = null;
     ControlCollection ctrlList = null;
     if (context.Instance is IAjaxDataSource)
     {
         ajaxSource = (IAjaxDataSource)context.Instance;
         ctrlList = ((Control)context.Instance).Page.Controls;
     }
     else if (context.Instance is InfoOwnerCollectionItem && ((InfoOwnerCollectionItem)context.Instance).Owner is IAjaxDataSource)
     {
         ajaxSource = ((InfoOwnerCollectionItem)context.Instance).Owner as IAjaxDataSource;
         ctrlList = (((InfoOwnerCollectionItem)context.Instance).Owner as Control).Page.Controls;
     }
     if (ajaxSource != null)
     {
         foreach (Control ctrl in ctrlList)
         {
             if (ctrl is WebDataSource && ctrl.ID == ajaxSource.DataSourceID)
             {
                 WebDataSource wds = (WebDataSource)ctrl;
                 DataTable srcTab = null;
                 if (string.IsNullOrEmpty(wds.SelectAlias) && string.IsNullOrEmpty(wds.SelectCommand))
                 {
                     if (wds.DesignDataSet == null)
                     {
                         WebDataSet ds = GloFix.CreateDataSet(wds.WebDataSetID);
                         wds.DesignDataSet = ds.RealDataSet;
                     }
                     srcTab = wds.DesignDataSet.Tables[wds.DataMember].Clone();
                 }
                 else
                 {
                     srcTab = wds.CommandTable.Clone();
                 }
                 foreach (DataColumn column in srcTab.Columns)
                 {
                     objName.Add(column.ColumnName);
                 }
                 break;
             }
         }
     }
     IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
     if (service != null)
     {
         StringListSelector selector = new StringListSelector(service, objName.ToArray());
         string strValue = (string)value;
         if (selector.Execute(ref strValue)) value = strValue;
     }
     return value;
 }
Esempio n. 16
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            var edSvc = (System.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService));

            var entity = (context.Instance as EntityShape).ModelElement as Entity;
            var popupUI = new SecurityFunctionForm();
            popupUI.Entity = entity;
            if (edSvc.ShowDialog(popupUI) == System.Windows.Forms.DialogResult.OK)
            {
                context.OnComponentChanged();
            }
            return value;
        }
Esempio n. 17
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            var edSvc = (System.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService));

            var popupUI = new CopyrightForm();
            popupUI.Copyright = (string)value;
            if (edSvc.ShowDialog(popupUI) == System.Windows.Forms.DialogResult.OK)
            {
                value = popupUI.Copyright;
                context.OnComponentChanged();
            }
            return value;
        }
 public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
 {
     IWindowsFormsEditorService svc = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
     if (svc != null) {
         using (Form form = CreateForm(value)) {
             if (svc.ShowDialog(form) == DialogResult.OK)
                 return OnResultOkay(form, value);
             else
                 return OnResultCancel(form, value);
         }
     }
     return value;
 }
Esempio n. 19
0
        /// <summary>
        /// Called when we want to edit the value of a property.  Brings up the Glyph Editor control.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="provider"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (edSvc != null && value is ArrayList)
            {
                GlyphEditor glyphEditor = new GlyphEditor();
                glyphEditor.Glyphs = value as ArrayList;

                if (edSvc.ShowDialog(glyphEditor) == DialogResult.OK)
                    return new ArrayList(glyphEditor.Glyphs);
            }

            return value;
        }
Esempio n. 20
0
        public void Load(System.IServiceProvider serviceProvider)
        {
            try
            {
                //must have the icelib sdk license to get the session as a service
                s_session = (Session)serviceProvider.GetService(typeof(Session));

            }
            catch (ArgumentNullException)
            {
                Debug.Fail("unable to get service.  Is the ICELIB SDK licence available?");
                throw;
            }
        }
Esempio n. 21
0
 public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
 {
     // Uses the IWindowsFormsEditorService to display a
     // drop-down UI in the Properties window.
     IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
     IGetValues aItem = (IGetValues)context.Instance;
     if (edSvc != null)
     {
         StringListSelector mySelector = new StringListSelector(edSvc, aItem.GetValues(context.PropertyDescriptor.Name));
         string strValue = (string)value;
         if (mySelector.Execute(ref strValue)) value = strValue;
     }
     return value;
 }
Esempio n. 22
0
        public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService svc = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;

            if (svc != null)
            {
                frmScript form = new frmScript();
                form.Script = value as string;
                svc.ShowDialog(form);
                value = form.Script;
            }

            return value;
        }
Esempio n. 23
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService EditorService = null;
            if (provider != null)
            {
                EditorService =
                    provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
            }

            if (EditorService != null)
            {
                System.Windows.Forms.ListBox AliasList = new System.Windows.Forms.ListBox();
                AliasList.Items.Add("(none)");
                AliasList.SelectionMode = System.Windows.Forms.SelectionMode.One;
                String serverPath = EFClientTools.DesignClientUtility.GetServerPath();
                String dbFile = serverPath + "\\DB.xml";
                XmlDocument DBXML = new XmlDocument();
                if (File.Exists(dbFile))
                {
                    DBXML.Load(dbFile);
                    XmlNode aNode = DBXML.DocumentElement.FirstChild;

                    while (aNode != null)
                    {
                        if (string.Compare(aNode.Name, "DATABASE", true) == 0)//IgnoreCase
                        {
                            XmlNode bNode = aNode.FirstChild;
                            while (bNode != null)
                            {
                                AliasList.Items.Add(bNode.LocalName);
                                bNode = bNode.NextSibling;
                            }
                        }
                        aNode = aNode.NextSibling;
                    }
                }
                AliasList.SelectedIndexChanged += delegate(object sender, EventArgs e)
                {
                    int index = AliasList.SelectedIndex;
                    if (index != -1)
                    {
                        value = AliasList.Items[index].ToString();
                    }
                    EditorService.CloseDropDown();
                };
                EditorService.DropDownControl(AliasList);
            }
            return value;
        }
Esempio n. 24
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService EditorService = null;
            if (provider != null)
            {
                EditorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
            }

            if (EditorService != null)
            {
                ListBox ColumnList = new ListBox();
                ColumnList.SelectionMode = SelectionMode.One;
                InfoComboBox combo = context.Instance as InfoComboBox;
                if (combo != null)
                {
                    XmlDocument DBXML = new XmlDocument();
                    if (File.Exists(SystemFile.DBFile))
                    {
                        DBXML.Load(SystemFile.DBFile);
                        XmlNode aNode = DBXML.DocumentElement.FirstChild;

                        while (aNode != null)
                        {
                            if (string.Compare(aNode.Name, "DATABASE", true) == 0)//IgnoreCase
                            {
                                XmlNode bNode = aNode.FirstChild;
                                while (bNode != null)
                                {
                                    ColumnList.Items.Add(bNode.LocalName);
                                    bNode = bNode.NextSibling;
                                }
                            }
                            aNode = aNode.NextSibling;
                        }
                    }
                }
                ColumnList.SelectedIndexChanged += delegate(object sender, EventArgs e)
                {
                    int index = ColumnList.SelectedIndex;
                    if (index != -1)
                    {
                        value = ColumnList.Items[index].ToString();
                    }
                    EditorService.CloseDropDown();
                };
                EditorService.DropDownControl(ColumnList);
            }
            return value;
        }
Esempio n. 25
0
 public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
 {
     if (context != null && context.Instance != null && provider != null)
     {
         IWindowsFormsEditorService windowsFormsEditorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
         if (windowsFormsEditorService != null)
         {
             System.Enum enumValue = (System.Enum)System.Convert.ChangeType(value, context.PropertyDescriptor.PropertyType);
             this.flagEnumCB.EnumValue = enumValue;
             windowsFormsEditorService.DropDownControl(this.flagEnumCB);
             return this.flagEnumCB.EnumValue;
         }
     }
     return null;
 }
Esempio n. 26
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc != null)
            {

                FAddressControl = new IPAddressControlLib.IPAddressControl();
                FAddressControl.Text = value.ToString();
                edSvc.DropDownControl(FAddressControl);

                return IPAddress.Parse(FAddressControl.Text);
            }
            return value;
        }
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            BindableProperty bindableProperty = (BindableProperty)context.PropertyDescriptor;
            ElementProperty property = (ElementProperty)bindableProperty.Property;
            ElementCollectionViewModel collection = (ElementCollectionViewModel)property.DeclaringElement.ChildElement(property.DeclaringProperty.Name);
            IUIServiceWpf uiService = (IUIServiceWpf)context.GetService(typeof(IUIServiceWpf));

            PopupCollectionEditorWindow w = new PopupCollectionEditorWindow()
            {
                ContainedContent = new HeaderedListLayout(collection, collection.AddCommands)
            };

            uiService.ShowDialog(w);

            return value;
        }
Esempio n. 28
0
        public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService svc = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
            IEnumerable<StorageTypeAttribute> attrs = context.PropertyDescriptor.Attributes.OfType<StorageTypeAttribute>();

            if (attrs.Count<StorageTypeAttribute>() > 0 && svc != null)
            {
                using (ChooseRowFromDBForm form = new ChooseRowFromDBForm(attrs.First <StorageTypeAttribute>().type))
                {
                    form.Value = (int)value;
                    if (svc.ShowDialog(form) == DialogResult.OK)
                        value = form.Value;
                }
            }
            return value;
        }
Esempio n. 29
0
        public VisualStudioWriter(DTE dte, System.IServiceProvider serviceProvider)
        {
            if (dte == null)
            {
                Debug.Write("Visual Studio Writer was passed a null DTE");

                if(System.Diagnostics.Debugger.IsAttached)
                    System.Diagnostics.Debugger.Break();

                return;
            }

            _outputWindowPane = LoadOutputWindowPane(dte);
            _errorListProvider = LoadErrorListPane(serviceProvider);
            _statusbar = serviceProvider.GetService(typeof (SVsStatusbar)) as IVsStatusbar;
        }
Esempio n. 30
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc != null)
            {
                // 可以打开任何特定的对话框

                OpenFileDialog dialog = new OpenFileDialog();
                dialog.AddExtension = false;
                if (dialog.ShowDialog().Equals(DialogResult.OK))
                {
                    return dialog.FileName;
                }
            }
            return value;
        }