Esempio n. 1
0
        Task <NormalResult> ContinueExcutePlan(XmlDocument task_dom,
                                               CancellationToken token)
        {
            return(Task <NormalResult> .Run(() =>
            {
                Replication replication = new Replication();
                LibraryChannel channel = this.GetChannel();
                try
                {
                    int nRet = replication.Initialize(channel,
                                                      out string strError);
                    if (nRet == -1)
                    {
                        return new NormalResult
                        {
                            Value = -1,
                            ErrorInfo = strError
                        }
                    }
                    ;

                    DatabaseConfig.ServerName = "localhost";
                    DatabaseConfig.DatabaseName = "testrep";
                    DatabaseConfig.UserName = "******";
                    DatabaseConfig.Password = "******";

                    nRet = replication.RunFirstPlan(
                        channel,
                        ref task_dom,
                        (message) =>
                    {
                        OutputHistory(message);
                    },
                        token,
                        out strError);
                    if (nRet == -1)
                    {
                        return new NormalResult
                        {
                            Value = -1,
                            ErrorInfo = strError
                        }
                    }
                    ;

                    return new NormalResult();
                }
                finally
                {
                    this.ReturnChannel(channel);
                }
            }));
        }