private void btnUpload_Click(object sender, RoutedEventArgs e)
        {
            var wsProxy = new MachineAccessTestServiceService();

            wsProxy.Credentials     = new NetworkCredential(Common.Username, Common.Password, null);
            wsProxy.PreAuthenticate = true;
            wsProxy.Timeout         = 2000;
            wsProxy.Url             = this.Url;

            try
            {
                var request = new machineAccessTestRequest()
                {
                    site     = this.site.Text.Trim(),
                    resource = this.resource.Text.Trim()
                };

                var response = wsProxy.getResourceDescription(new getResourceDescription()
                {
                    pRequest = request
                });
                this.status.Text      = [email protected];
                this.message.Text     = [email protected];
                this.description.Text = [email protected];
            }
            catch (Exception ex)
            {
                this.status.Text      = "ERROR";
                this.message.Text     = ex.Message;
                this.description.Text = ex.ToString();
            }
            finally
            {
                if (this.status.Text.Trim().ToLower() == "true")
                {
                    this.status.Foreground      = Brushes.Green;
                    this.message.Foreground     = Brushes.Green;
                    this.description.Foreground = Brushes.Green;
                }
                else
                {
                    this.status.Foreground      = Brushes.Red;
                    this.message.Foreground     = Brushes.Red;
                    this.description.Foreground = Brushes.Red;
                }
            }

            ShowLog();
        }
Пример #2
0
        /// <summary>
        /// 測試系統接口
        /// </summary>
        /// <returns></returns>
        public bool TestSystemService()
        {
            getResourceDescriptionResponse  ReturnInfo = new getResourceDescriptionResponse();
            MachineAccessTestServiceService Service    = new MachineAccessTestServiceService();

            Service.Url         = "http://10.10.156.11:51000/sapdevwebservice/MachineAccessTestServiceService?wsdl";
            Service.Credentials = new System.Net.NetworkCredential(Core.AppContext.Current.MesModel.Account, Core.AppContext.Current.MesModel.Pwd, null);
            machineAccessTestRequest test = new machineAccessTestRequest()
            {
                resource = "3BKX0001",
                site     = "1003",
            };
            getResourceDescription grt = new getResourceDescription()
            {
                pRequest = test,
            };

            ReturnInfo = Service.getResourceDescription(grt);
            return([email protected]() == "TRUE" ? true : false);
        }