Example #1
0
 public MainFormPresenter(IAuctionMainFormView view)
 {
     Notifypresenter = new NotifyPresenter(this);
     this.View       = view;
     InitTimer();
     //Notifypresenter.ServiceProxy.ErrorMessage += new EventHandler<MessageSubscriber.MessageEventArgs>(ServiceProxy_ErrorMessage);
     base.ServiceProxy.ErrorMessage += new EventHandler <MessageSubscriber.MessageEventArgs>(ServiceProxy_ErrorMessage);
 }
Example #2
0
        public void GetFiles(IAuctionMainFormView view, bool isNotify, string path)
        {
            this.CurView        = view;
            this.IsNotifyNoFile = isNotify;
            ServiceRequest request = new  ServiceRequest();

            request.ServiceName = "FileUpdate";
            request.MethodName  = "CurGetAllFiles";
            request.Parameters  = new object[] { };
            base.ServiceProxy.RequestService <List <FileInfos> >(request, DataType.Json, (message) =>
            {
                #region 每次重新查询文件目录的时候清空CurListInfos

                if (CurListInfos != null)
                {
                    CurListInfos.Clear();
                }

                #endregion

                List <FileInfos> curInfos = message;
                foreach (var item in curInfos)
                {
                    CurSearchFiles(item.FilePath, item.FileModifyTime, path);
                }

                //对比本地文件得出需要更新的列表
                List <FileInfos> localFile = CurListInfos;

                _index = 0;
                if (localFile != null)
                {
                    IsMustRestart = CurListInfos.Exists(o => o.FilePath.ToLower().EndsWith(".dll") || o.FilePath.ToLower().EndsWith(".exe"));
                    DowlaodFile();
                }
                else
                {
                    if (isNotify)
                    {
                        CurView.ShowMessage("没有需要更新的文件");
                    }
                }
            });
        }