private void OnClick(object sender, System.EventArgs e) { IResource handler = (IResource)_handlers[0]; string friendlyName = handler.GetPropText(ProtocolHandlersInResourceStore._propFriendlyName); string message = "Would you like to check on Omea startup that it is the default '" + friendlyName + "' ?"; DialogResult result = MessageBox.Show(message, Core.ProductFullName, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3); if (result == DialogResult.Cancel) { return; } foreach (IResource protocol in _handlers) { ProtocolHandlerManager.SetAsDefaultHandler(protocol, result == DialogResult.Yes); } string protocolName = handler.GetPropText(ProtocolHandlersInResourceStore._propProtocol); if (ProtocolHandlersInRegistry.IsDefaultHandler(protocolName)) { _defaultText.Text = "Default"; _makeDefault.Visible = false; } else { _defaultText.Text = "Not Default"; _makeDefault.Visible = true; } }
public static void SetAsDefaultHandler(IResource resProtocol, bool check) { ProtocolHandlerManager manager = Core.ProtocolHandlerManager as ProtocolHandlerManager; Guard.NullLocalVariable(manager, "manager"); string protocol = resProtocol.GetPropText(_propProtocol); ProtocolHandlersInRegistry.SetAsDefaultHandler(protocol, resProtocol.GetPropText(_propFriendlyName)); SetCheckNeeded(protocol, check); manager.InvokeMakeDefault(protocol); }
private static void SaveProtocolSettings(ResourceProxy proxy, string friendlyName, Default defProtocol) { CheckRegistration(); proxy.AsyncPriority = JobPriority.Immediate; proxy.SetProp(_propFriendlyName, friendlyName); if (defProtocol != Default.NoChanges) { proxy.SetProp(_propDefault, defProtocol == Default.Yes); } proxy.EndUpdate(); if (proxy.Resource.HasProp(_propDefault)) { ProtocolHandlersInRegistry.SetAsDefaultHandler(proxy.Resource.GetPropText(_propProtocol), friendlyName); } }
private void CheckProtocolsImpl(IWin32Window parent) { IResourceList protocolHandlers = GetProtocolsToCheck(); HashMap protocolSet = GetProtocols(protocolHandlers); foreach (HashMap.Entry entry in protocolSet) { ArrayList list = (ArrayList)entry.Value; foreach (IResource protocol in list) { string protocolName = protocol.GetStringProp(PROTOCOL); if (!ProtocolHandlersInRegistry.IsDefaultHandler(protocolName)) { CheckProtocols(parent, list); break; } } } }
public ProtocolCtrl(ProtocolHandlerOptionsPane pane, ArrayList handlers, int index) { _handlers = handlers; IResource handler = (IResource)_handlers[0]; string friendlyName = handler.GetPropText(ProtocolHandlersInResourceStore._propFriendlyName) + ": "; _friendlyName.Text = friendlyName.Substring(0, 1).ToUpper() + friendlyName.Remove(0, 1); bool isDefaultHandler = true; foreach (IResource protocol in handlers) { if (!ProtocolHandlersInRegistry.IsDefaultHandler(protocol.GetPropText(ProtocolHandlersInResourceStore._propProtocol))) { isDefaultHandler = false; break; } } if (isDefaultHandler) { _defaultText.Text = "Default"; _makeDefault.Visible = false; } else { _defaultText.Text = "Not Default"; } int coordY = index * 25 + 12; // // _friendlyName // _friendlyName.FlatStyle = System.Windows.Forms.FlatStyle.System; _friendlyName.Location = new System.Drawing.Point(8, coordY); _friendlyName.Size = new System.Drawing.Size(200, 20); _friendlyName.TabIndex = 0; // // _defaultText // _defaultText.FlatStyle = System.Windows.Forms.FlatStyle.System; _defaultText.Location = new System.Drawing.Point(216, coordY); _defaultText.Size = new System.Drawing.Size(92, 20); _defaultText.TabIndex = 2; // // _makeDefault // _makeDefault.FlatStyle = System.Windows.Forms.FlatStyle.System; _makeDefault.Location = new System.Drawing.Point(328, coordY - 4); _makeDefault.Size = new System.Drawing.Size(88, 23); _makeDefault.TabIndex = 1; _makeDefault.Text = "Make Default"; _makeDefault.Click += new System.EventHandler(this.OnClick); // // ProtocolHandlerOptionsPane // pane.Controls.Add(_friendlyName); pane.Controls.Add(_defaultText); if (handler.GetPropText(ProtocolHandlersInResourceStore._propProtocol).ToLower() != "http") { pane.Controls.Add(_makeDefault); } }