当前位置: 首页>>代码示例>>C#>>正文


C# IProgress.SetStatus方法代码示例

本文整理汇总了C#中IProgress.SetStatus方法的典型用法代码示例。如果您正苦于以下问题:C# IProgress.SetStatus方法的具体用法?C# IProgress.SetStatus怎么用?C# IProgress.SetStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IProgress的用法示例。


在下文中一共展示了IProgress.SetStatus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetHandheldComments

        public void GetHandheldComments(IProgress progressUpdate, bool fullSync)
        {
            HandheldCommentsResponse response = null;
                GetHandheldCommentsRequest request = new GetHandheldCommentsRequest();
                request.DaysBack = Config.AppSettings.Ref.ProgramSettings.DaysToKeepHandheldComments;
                request.DaysBackSpecified = true;
                request.RideCredential = _rideCredential;
                request.Request = new RequestArgument();
                if (fullSync)
                {
                    request.Request.RequestType = RequestArgumentRequestTypes.FullSync;
                    request.Request.RequestTypeSpecified = true;
                    request.Request.DateSpecified = false;
                }
                else
                {
                    request.Request.RequestType = RequestArgumentRequestTypes.SyncFromDate;
                    request.Request.RequestTypeSpecified = true;
                    request.Request.Date = Data.DataHolder.Ref.GetSyncDate(DataHolder.SyncTypes.HandheldComments);
                    request.Request.DateSpecified = true;
                }
                try
                {
                    using (RideWCFServiceImplementation client = GetSyncClient())
                    {
                        response = client.GetHandheldComments(request);
                    }

                }
                catch (System.Web.Services.Protocols.SoapException ex)
                {
                    Console.Write(ex.Message);
                }
                catch (Exception ex)
                {
                    Console.Write(ex.Message);
                }
                finally
                {
                    if (response != null && response.Success)
                    {
                        #region Comments
                            progressUpdate.IncrementProgress();
                            if (response.Comments.Length > 0)
                            {
                                progressUpdate.SetStatus("Updating Handheld Comments");
                                if (request.Request.RequestType == RequestArgumentRequestTypes.FullSync)
                                    Data.DataHolder.Ref.ClearHandheldComments(true);
                                else
                                    Data.DataHolder.Ref.ClearHandheldComments(false);
                                foreach (Comment comment in response.Comments)
                                {
                                    Data.DataHolder.Ref.SaveHandheldComment(Converter.Comment(comment));
                                }
                            }
                        #endregion

                        #region Save Last Sync Date
                        if (response.ServerSyncTimeSpecified)
                            Data.DataHolder.Ref.SaveSyncDate(DataHolder.SyncTypes.HandheldComments, response.ServerSyncTime);
                        #endregion
                    }
                }
        }
开发者ID:inetstd,项目名称:ridesystems,代码行数:64,代码来源:SyncController.cs

示例2: SyncStaticObjects

        public void SyncStaticObjects(IProgress progressUpdate, bool fullSync)
        {
            HandheldStaticSyncResponse response = null;
                HandheldStaticSyncRequest request = new HandheldStaticSyncRequest();
                DateTime syncDate = DateTime.MinValue;
                request.Request = new RequestArgument();
                request.RideCredential = _rideCredential;
                request.HistoricalDays = 0;
                request.HistoricalDaysSpecified = true;
                if (!fullSync)
                    syncDate = Data.DataHolder.Ref.GetSyncDate(DataHolder.SyncTypes.StaticObjects);
                if (syncDate==DateTime.MinValue)
                {
                    request.Request.RequestType = RequestArgumentRequestTypes.FullSync;
                    request.Request.RequestTypeSpecified = true;
                    request.Request.DateSpecified = false;
                }
                else
                {
                    request.Request.RequestType = RequestArgumentRequestTypes.SyncFromDate;
                    request.Request.RequestTypeSpecified = true;
                    request.Request.Date=syncDate;
                    request.Request.DateSpecified = true;
                }
                try
                {
                    using (RideWCFServiceImplementation client = GetSyncClient())
                    {
                        response = client.GetHandheldStaticSync(request);
                    }

                }
                catch (System.Web.Services.Protocols.SoapException ex)
                {
                    Console.Write(ex.Message);
                }
                catch (Exception ex)
                {
                    Console.Write(ex.Message);
                }
                finally
                {
                    if (response != null && response.Success)
                    {
                        #region Save
                            #region Employee Types
                                progressUpdate.IncrementProgress();
                                #region Save
                                    if (response.EmployeeTypes.Length > 0)
                                    {
                                        progressUpdate.SetStatus("Updating Employee Types");
                                        if (request.Request.RequestType == RequestArgumentRequestTypes.FullSync)
                                            Data.DataHolder.Ref.ClearEmployeeTypes();
                                        foreach (EmployeeType employeeType in response.EmployeeTypes)
                                        {
                                            Data.DataHolder.Ref.SaveEmployeeType(Converter.EmployeeType(employeeType));
                                        }
                                    }
                                #endregion
                                #region Delete
                                    if (response.DeletedEmployeeTypes != null && response.DeletedEmployeeTypes.Length > 0)
                                    {
                                        progressUpdate.SetStatus("Deleting Employee Types");
                                        foreach (int employeeType in response.DeletedEmployeeTypes)
                                        {
                                            Data.DataHolder.Ref.DeleteEmployeeType(employeeType);
                                        }
                                    }
                                #endregion
                            #endregion

                            #region Client Types
                                progressUpdate.IncrementProgress();
                                #region Save
                                    if (response.ClientTypes.Length > 0)
                                    {
                                        progressUpdate.SetStatus("Updating Client Types");
                                        if (request.Request.RequestType == RequestArgumentRequestTypes.FullSync)
                                            Data.DataHolder.Ref.ClearClientTypes();
                                        foreach (ClientType clientType in response.ClientTypes)
                                        {
                                            Data.DataHolder.Ref.SaveClientType(Converter.ClientType(clientType));
                                        }
                                    }
                                #endregion
                                #region Delete
                                    if (response.DeletedClientTypes != null && response.DeletedClientTypes.Length > 0)
                                    {
                                        progressUpdate.SetStatus("Deleting Client Types");
                                        foreach (int clientType in response.DeletedClientTypes)
                                        {
                                            Data.DataHolder.Ref.DeleteClientType(clientType);
                                        }
                                    }
                                #endregion
                            #endregion

                            #region Address Types
                                progressUpdate.IncrementProgress();
                                #region Save
//.........这里部分代码省略.........
开发者ID:inetstd,项目名称:ridesystems,代码行数:101,代码来源:SyncController.cs


注:本文中的IProgress.SetStatus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。