Exemplo n.º 1
0
        private void addApp()
        {
            if (client != null)
            {
                client.Dispose();
                client = null;
            }

            double price = 0.0f;

            if (!double.TryParse(this.priceTextBox.Text, out price))
            {
            }

            //     string userId = this.userIdTextBox.Text;
            //     string password = this.passwordTextBox.Password;
            if (string.IsNullOrEmpty(userId))
            {
                MessageBox.Show("请输入用户ID", "上传应用", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            if (string.IsNullOrEmpty(password))
            {
                MessageBox.Show("请输入用户密码", "上传应用", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            APKSoftModel module = new APKSoftModel();

            module.AddDate       = DateTime.Now.ToUniversalTime();
            module.Attach        = new APKAttachModel();
            module.Attach.Image1 = this.getSnapshot(0);
            module.Attach.Image2 = this.getSnapshot(1);
            module.Attach.Image3 = this.getSnapshot(2);
            module.Attach.Image4 = this.getSnapshot(3);
            module.Attach.Image5 = this.getSnapshot(4);
            module.ClassID       = this.appItem.AppType;
            module.SubClassID    = this.appItem.AppSubType;
            module.TopicNum      = 0;
            module.UniqueId      = this.appItem.Id;
            module.UserID        = 0; // TODO
            module.Version       = ProjectMgr.Instance.App.Version;
            module.Detail        = this.descriptionTextBox.Text;
            module.DownNum       = 0;

            FileStream fs = File.OpenRead(this.packageFile);

            module.Filesize = new decimal(fs.Length);
            fs.Close();

            module.FileUrl    = this.appUrl;
            module.ICON       = this.iconUrl;
            module.IsIndex    = 0; // TODO;
            module.IsNew      = 1;
            module.IsUse      = 0;
            module.Md5Check   = GetMD5HashFromFile(this.packageFile); // TODO
            module.Name       = this.appItem.Title;
            module.Price      = new decimal(price);
            module.Sketch     = this.appItem.Description;
            module.SubClassID = this.appItem.AppSubType;

            try
            {
                AppServerSoapClient service = new AppServerSoapClient();
                service.Endpoint.Address = new System.ServiceModel.EndpointAddress(@"http://www.soonlearning.com/WebServers/AppServer.asmx");
                service.AddApp(module, userId, Helper.GetMD5Hash(password), Helper.GetMD5Hash("$df9!d^_"));
                TypeItem item = this.subCategoryComboBox.SelectedItem as TypeItem;
                {
                    module.ClassID    = item.ParentType;
                    module.SubClassID = item.Type;
                    service.AddApp(module, userId, Helper.GetMD5Hash(password), Helper.GetMD5Hash("$df9!d^_"));
                }
                this.uploadStatusTextBox.Text = "应用上传成功.";
            }
            catch (Exception ex)
            {
                this.uploadStatusTextBox.Text = string.Format("应用上传失败:{0}", ex.Message);
            }

            this.enableCtrls(true);
        }
Exemplo n.º 2
0
 public void AddApp(APKSoftModel app, string userId, string password, string key)
 {
     base.Channel.AddApp(app, userId, password, key);
 }