private void Application_Startup(object sender, StartupEventArgs e) { string callbackName = e.InitParams["callbackName"]; ClipboardButtonType buttonType = (ClipboardButtonType)Enum.Parse( typeof(ClipboardButtonType), e.InitParams["buttonType"], false); this.RootVisual = new ClipboardButton( buttonType, callbackName, e.InitParams); }
/// <param name="buttonType"> /// The clipboard event that the button will fire. /// </param> /// <param name="callbackName"> /// The name of a callback into JS. If it's a Paste, it /// should be a function(string): void that accepts the clipboard contents. /// If it's a Copy, it should be a function(): string that returns /// the content to put on the clipboard. /// </param> /// <param name="buttonProperties"> /// Other properties for the button, like Content. /// </param> public ClipboardButton(ClipboardButtonType buttonType, string callbackName, IDictionary<string, string> buttonProperties) { this.buttonType = buttonType; this.callbackName = callbackName; InitializeComponent(); if (buttonProperties.Keys.Contains("Content")) { button.Content = buttonProperties["Content"]; } }
/// <param name="buttonType"> /// The clipboard event that the button will fire. /// </param> /// <param name="callbackName"> /// The name of a callback into JS. If it's a Paste, it /// should be a function(string): void that accepts the clipboard contents. /// If it's a Copy, it should be a function(): string that returns /// the content to put on the clipboard. /// </param> /// <param name="buttonProperties"> /// Other properties for the button, like Content. /// </param> public ClipboardButton(ClipboardButtonType buttonType, string callbackName, IDictionary <string, string> buttonProperties) { this.buttonType = buttonType; this.callbackName = callbackName; InitializeComponent(); if (buttonProperties.Keys.Contains("Content")) { button.Content = buttonProperties["Content"]; } }