/// <summary> /// Creates an <see cref="ICommand"/> according to the specified <see cref="CommandName"/>. /// </summary> /// <param name="commandName">One of the values of <see cref="CommandName"/>.</param> /// <param name="communicationProxy">The communication proxy as an instance of <see cref="IDokuWikiProvider"/>.</param> /// <param name="wikiClient">The "local" wiki client which has access to the persited data.</param> /// <returns> /// The created instance to the given named command. /// </returns> /// <exception cref="ArgumentNullException">Is thrown when <paramref name="communicationProxy"/> is a <see langword="null"/> reference.</exception> /// <exception cref="ArgumentNullException"> Is thrown when /// <para><paramref name="communicationProxy"/> is a <see langword="null"/> reference</para> /// <para>- or -</para> /// <para><paramref name="wikiClient"/> is a <see langword="null"/> reference.</para> /// </exception> /// <exception cref="ArgumentException">Is thrown when <paramref name="commandName"/> is not defined in <see cref="CommandName"/>.</exception> public static ICommand CreateCommand(CommandName commandName, IDokuWikiProvider communicationProxy, IDokuWikiClient wikiClient) { if (communicationProxy == null) { throw new ArgumentNullException("communicationProxy"); } if (wikiClient == null) { throw new ArgumentNullException("wikiClient"); } if (!Enum.IsDefined(typeof(CommandName), commandName)) { throw new ArgumentException("Unkown command name", "commandName"); } switch (commandName) { case CommandName.GetWikiPage: return(new GetWikiPageCommand(communicationProxy)); case CommandName.GetAllPages: return(new GetAllPageItemsCommand(communicationProxy)); case CommandName.GetWikiPageAsHtml: return(new GetWikiPageAsHtmlCommand(communicationProxy)); case CommandName.LoadMethodHelp: return(new LoadMethodHelpCommand(communicationProxy)); case CommandName.LoadMethodSignatures: return(new LoadMethodSignaturesCommand(communicationProxy)); case CommandName.ListStoredWikiAccounts: return(new ListStoredWikiAccountsCommand(wikiClient, communicationProxy)); case CommandName.ListServerMethods: return(new ListServerMethodsCommand(communicationProxy)); case CommandName.ExitApplication: default: throw new NotImplementedException("No command available for this command name."); } }
/// <summary> /// Creates an <see cref="ICommand"/> according to the specified <see cref="CommandName"/>. /// </summary> /// <param name="commandName">One of the values of <see cref="CommandName"/>.</param> /// <param name="communicationProxy">The communication proxy as an instance of <see cref="IDokuWikiProvider"/>.</param> /// <param name="wikiClient">The "local" wiki client which has access to the persited data.</param> /// <returns> /// The created instance to the given named command. /// </returns> /// <exception cref="ArgumentNullException">Is thrown when <paramref name="communicationProxy"/> is a <see langword="null"/> reference.</exception> /// <exception cref="ArgumentNullException"> Is thrown when /// <para><paramref name="communicationProxy"/> is a <see langword="null"/> reference</para> /// <para>- or -</para> /// <para><paramref name="wikiClient"/> is a <see langword="null"/> reference.</para> /// </exception> /// <exception cref="ArgumentException">Is thrown when <paramref name="commandName"/> is not defined in <see cref="CommandName"/>.</exception> public static ICommand CreateCommand(CommandName commandName, IDokuWikiProvider communicationProxy, IDokuWikiClient wikiClient) { if (communicationProxy == null) { throw new ArgumentNullException("communicationProxy"); } if (wikiClient == null) { throw new ArgumentNullException("wikiClient"); } if (!Enum.IsDefined(typeof(CommandName), commandName)) { throw new ArgumentException("Unkown command name", "commandName"); } switch (commandName) { case CommandName.GetWikiPage: return new GetWikiPageCommand(communicationProxy); case CommandName.GetAllPages: return new GetAllPageItemsCommand(communicationProxy); case CommandName.GetWikiPageAsHtml: return new GetWikiPageAsHtmlCommand(communicationProxy); case CommandName.LoadMethodHelp: return new LoadMethodHelpCommand(communicationProxy); case CommandName.LoadMethodSignatures: return new LoadMethodSignaturesCommand(communicationProxy); case CommandName.ListStoredWikiAccounts: return new ListStoredWikiAccountsCommand(wikiClient, communicationProxy); case CommandName.ListServerMethods: return new ListServerMethodsCommand(communicationProxy); case CommandName.ExitApplication: default: throw new NotImplementedException("No command available for this command name."); } }
/// <summary> /// Initializes a new instance of the <see cref="Command"/> class. /// </summary> /// <param name="provider">The provider which encapsulates the communication with the remote host.</param> protected Command(IDokuWikiProvider provider) { this.communicationProxy = provider; }
/// <summary> /// Initializes a new instance of the <see cref="ListStoredWikiAccountsCommand"/> class. /// </summary> /// <param name="wikiProvider">The wiki provider which gives us access to the remote host.</param> public ListStoredWikiAccountsCommand(IDokuWikiClient wikiClient, IDokuWikiProvider wikiProvider) : base(wikiProvider) { this.Name = CommandName.ListStoredWikiAccounts; this.wikiClient = wikiClient; }
/// <summary> /// Initializes a new instance of the <see cref="GetAllPageItemsCommand"/> class. /// </summary> /// <param name="wikiProvider">The wiki provider which gives us access to the remote host.</param> public GetAllPageItemsCommand(IDokuWikiProvider wikiProvider) : base(wikiProvider) { this.Name = CommandName.GetAllPages; }
/// <summary> /// Initializes a new instance of the <see cref="LoadMethodHelpCommand"/> class. /// </summary> /// <param name="wikiProvider">The wiki provider which gives us access to the remote host.</param> public LoadMethodHelpCommand(IDokuWikiProvider wikiProvider) : base(wikiProvider) { this.Name = CommandName.LoadMethodHelp; }
/// <summary> /// Initializes a new instance of the <see cref="GetWikiPageAsHtmlCommand"/> class. /// </summary> /// <param name="wikiProvider">The wiki provider which gives us access to the remote host.</param> public GetWikiPageAsHtmlCommand(IDokuWikiProvider wikiProvider) : base(wikiProvider) { this.Name = CommandName.GetWikiPageAsHtml; }
/// <summary> /// Initializes a new instance of the <see cref="LoadMethodSignaturesCommand"/> class. /// </summary> /// <param name="wikiProvider">The wiki provider which gives us access to the remote host.</param> public LoadMethodSignaturesCommand(IDokuWikiProvider wikiProvider) : base(wikiProvider) { this.Name = CommandName.LoadMethodSignatures; }
/// <summary> /// Initializes the connection to the remote Xml - Rpc wiki server. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.ComponentModel.DoWorkEventArgs"/> instance containing the event data.</param> private void BeginConnectToWiki(object sender, DoWorkEventArgs e) { this.clientProxy = XmlRpcProxyFactory.CreateSecureCommunicationProxy(new Uri(this.activeAccount.WikiUrlRaw), this.activeAccount.LoginName, this.activeAccount.Password); clientProxy.ListServerMethods(); }
/// <summary> /// Initializes a new instance of the <see cref="ListServerMethodsCommand"/> class. /// </summary> /// <param name="wikiProvider">The wiki provider which gives us access to the remote host.</param> public ListServerMethodsCommand(IDokuWikiProvider wikiProvider) : base(wikiProvider) { this.Name = CommandName.ListServerMethods; }