private void Init()
 {
     try
     {
         if (PropertyItem == null)
         {
             return;
         }
         CurrentApp          = PropertyItem.CurrentApp;
         PropertyItem.Editor = this;
         if (CurrentApp == null)
         {
             return;
         }
         mWidgetItem         = PropertyItem.WidgetItem;
         mWidgetPropertyInfo = PropertyItem.PropertyInfo;
         if (mWidgetPropertyInfo != null)
         {
             ConvertFormat = mWidgetPropertyInfo.ConvertFormat;
         }
         mWidgetPropertyValue = PropertyItem.PropertyValue;
         if (mWidgetPropertyValue != null)
         {
             Value = mWidgetPropertyValue.Value01;
             Text  = mWidgetPropertyValue.Value01;
         }
         InitEnumItems();
         ShowValue();
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
示例#2
0
        private void LoadWidgetPropertyInfos()
        {
            try
            {
                mListWidgetPropertyInfos.Clear();
                if (WidgetItem == null)
                {
                    return;
                }
                WebRequest webRequest = new WebRequest();
                webRequest.Session = CurrentApp.Session;
                webRequest.Code    = (int)S1200Codes.GetWidgetPropertyInfoList;
                webRequest.ListData.Add(WidgetItem.WidgetID.ToString());
                Service12001Client client = new Service12001Client(
                    WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                    WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service12001"));
                WebReturn webReturn = client.DoOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    ShowException(string.Format("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                    return;
                }
                if (webReturn.ListData == null)
                {
                    ShowException(string.Format("Fail.\tListData is null"));
                    return;
                }
                OperationReturn optReturn;
                for (int i = 0; i < webReturn.ListData.Count; i++)
                {
                    string strInfo = webReturn.ListData[i];
                    optReturn = XMLHelper.DeserializeObject <WidgetPropertyInfo>(strInfo);
                    if (!optReturn.Result)
                    {
                        ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        return;
                    }
                    WidgetPropertyInfo info = optReturn.Data as WidgetPropertyInfo;
                    if (info == null)
                    {
                        ShowException(string.Format("WidgetPropertyInfo is null"));
                        return;
                    }
                    mListWidgetPropertyInfos.Add(info);
                }

                CurrentApp.WriteLog("LoadPropertyInfos", string.Format("End.\t{0}", mListWidgetPropertyInfos.Count));
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }