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);
     }
 }
Ejemplo n.º 2
0
        private void LoadUserWidgetPropertyValues()
        {
            try
            {
                mListWidgetPropertyValues.Clear();
                if (WidgetItem == null)
                {
                    return;
                }
                WebRequest webRequest = new WebRequest();
                webRequest.Session = CurrentApp.Session;
                webRequest.Code    = (int)S1200Codes.GetUserWidgetPropertyValueList;
                webRequest.ListData.Add(CurrentApp.Session.UserID.ToString());
                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 <UserWidgetPropertyValue>(strInfo);
                    if (!optReturn.Result)
                    {
                        ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        return;
                    }
                    UserWidgetPropertyValue info = optReturn.Data as UserWidgetPropertyValue;
                    if (info == null)
                    {
                        ShowException(string.Format("WidgetPropertyInfo is null"));
                        return;
                    }
                    mListWidgetPropertyValues.Add(info);
                }

                CurrentApp.WriteLog("LoadPropertyValues", string.Format("End.\t{0}", mListWidgetPropertyValues.Count));
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
Ejemplo n.º 3
0
        private void InitPropertyItems()
        {
            try
            {
                mListWidgetPropertyItems.Clear();
                for (int i = 0; i < mListWidgetPropertyInfos.Count; i++)
                {
                    var info = mListWidgetPropertyInfos[i];
                    WidgetPropertyItem item = new WidgetPropertyItem();
                    item.WidgetID     = info.WidgetID;
                    item.PropertyID   = info.PropertyID;
                    item.Name         = info.Name;
                    item.Display      = CurrentApp.GetLanguageInfo(string.Format("1206WP{0}{1}", info.WidgetID, info.PropertyID.ToString("000")), info.Name);
                    item.Description  = item.Display;
                    item.PropertyInfo = info;
                    GetItemDescription(item);

                    var propertyValue =
                        mListWidgetPropertyValues.FirstOrDefault(
                            p =>
                            p.WidgetID == item.WidgetID && p.UserID == CurrentApp.Session.UserID &&
                            p.PropertyID == item.PropertyID);
                    if (propertyValue == null)
                    {
                        propertyValue            = new UserWidgetPropertyValue();
                        propertyValue.WidgetID   = item.WidgetID;
                        propertyValue.UserID     = CurrentApp.Session.UserID;
                        propertyValue.PropertyID = item.PropertyID;
                        propertyValue.Value01    = info.DefaultValue;
                        mListWidgetPropertyValues.Add(propertyValue);
                    }
                    item.PropertyValue = propertyValue;

                    item.CurrentApp            = CurrentApp;
                    item.WidgetItem            = WidgetItem;
                    item.ListAllPropertyItems  = mListWidgetPropertyItems;
                    item.ListAllPropertyValues = mListWidgetPropertyValues;

                    mListWidgetPropertyItems.Add(item);
                }
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
Ejemplo n.º 4
0
        private void LoadWidgetPropertyValues()
        {
            try
            {
                mListPropertyValues.Clear();
                if (WidgetItem == null)
                {
                    return;
                }
                WebRequest webRequest = new WebRequest();
                webRequest.Session = CurrentApp.Session;
                webRequest.Code    = (int)S1200Codes.GetUserWidgetPropertyValueList;
                webRequest.ListData.Add(CurrentApp.Session.UserID.ToString());
                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)
                {
                    return;
                }
                for (int i = 0; i < webReturn.ListData.Count; i++)
                {
                    string          strInfo   = webReturn.ListData[i];
                    OperationReturn optReturn = XMLHelper.DeserializeObject <UserWidgetPropertyValue>(strInfo);
                    if (!optReturn.Result)
                    {
                        ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        return;
                    }
                    UserWidgetPropertyValue info = optReturn.Data as UserWidgetPropertyValue;
                    if (info == null)
                    {
                        continue;
                    }
                    mListPropertyValues.Add(info);
                }

                int intValue;
                for (int i = 0; i < mListPropertyValues.Count; i++)
                {
                    var    propertyValue = mListPropertyValues[i];
                    string strValue      = propertyValue.Value01;
                    switch (propertyValue.PropertyID)
                    {
                    case WIDGET_PROPERTY_ID_DEFAULTSIZE:
                        if (int.TryParse(strValue, out intValue) &&
                            intValue > 0)
                        {
                            mDefaultSize = intValue;
                        }
                        break;

                    case WIDGET_PROPERTY_ID_NEXTSIZE:
                        if (int.TryParse(strValue, out intValue) &&
                            intValue > 0)
                        {
                            mNextSize = intValue;
                        }
                        break;

                    case WIDGET_PROPERTY_ID_ONLYMYSELF:
                        mOnlyMyself = strValue == "1";
                        break;
                    }
                }

                CurrentApp.WriteLog("LoadPropertyValues", string.Format("Load end.\t{0}", mListPropertyValues.Count));
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }