Пример #1
0
        /// <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.");
			}
		}
Пример #3
0
 /// <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;
		}
Пример #5
0
 /// <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;
		}
Пример #7
0
 /// <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="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="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 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;
		}
Пример #11
0
		/// <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 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();
		}
Пример #13
0
 /// <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 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;
		}
Пример #15
0
 /// <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;
 }
Пример #16
0
 /// <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;
 }
Пример #17
0
 /// <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();
 }
Пример #18
0
 /// <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;
 }