Example #1
0
 public void AddReceiverInfo(Receiver reciverInfo)
 {
     if (this.ReceiveInfos.Count() == 0)
     {
         reciverInfo.IsDefault = true;
     }
     ReceiveInfos.Add(reciverInfo);
 }
        private void ConnectServer()
        {
            try
            {
                ClientBasicInfo cb = new ClientBasicInfo()
                {
                    ProductName           = RequestInfos.FirstOrDefault(x => string.Equals(x.RName, "ProductNameInEng", StringComparison.OrdinalIgnoreCase))?.RValue,
                    RevitVersion          = RequestInfos.FirstOrDefault(x => string.Equals(x.RName, "RevitVersion", StringComparison.OrdinalIgnoreCase))?.RValue,
                    CurrentProductVersion = RequestInfos.FirstOrDefault(x => string.Equals(x.RName, "ProductVersion", StringComparison.OrdinalIgnoreCase))?.RValue
                };
                ClientInfo = cb;
                DownloadFileInfo df = new DownloadFileInfo();

                var result = RequestInfoUtils.RequestDownloadFileInfo(cb, "http://localhost:55756/", "GetFileInfo", "GetInfo", ref df);
                DownloadInfo = df;
                if (result)
                {
                    ClientInfoModel r1 = new ClientInfoModel()
                    {
                        RName  = "LatestProductVersion",
                        RValue = df.LatestProductVersion
                    };
                    ClientInfoModel r2 = new ClientInfoModel()
                    {
                        RName  = "DownloadFileMd5",
                        RValue = df.DownloadFileMd5
                    };
                    ClientInfoModel r3 = new ClientInfoModel()
                    {
                        RName  = "DownloadFileTotalSize",
                        RValue = df.DownloadFileTotalSize.ToString()
                    };
                    ReceiveInfos.Add(r1);
                    ReceiveInfos.Add(r2);
                    ReceiveInfos.Add(r3);
                }
                else
                {
                    MessageBox.Show("Get DownLoad File Failed!");
                }
            }
            catch
            {
                MessageBox.Show("Get DownLoad File Failed!");
            }
        }