Example #1
0
        private void LoadChannelObjects()
        {
            try
            {
                mListChannelObjects.Clear();
                OperationReturn optReturn;
                for (int i = 0; i < mListVoiceObjects.Count; i++)
                {
                    var  voice      = mListVoiceObjects[i];
                    long voiceObjID = voice.ObjID;

                    WebRequest webRequest = new WebRequest();
                    webRequest.Session = CurrentApp.Session;
                    webRequest.Code    = (int)S2106Codes.GetChannelList;
                    webRequest.ListData.Add(CurrentApp.Session.UserInfo.UserID.ToString());
                    webRequest.ListData.Add(voiceObjID.ToString());
                    Service21061Client client = new Service21061Client(
                        WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                        WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service21061"));
                    WebReturn webReturn = client.DoOperation(webRequest);
                    if (!webReturn.Result)
                    {
                        ShowException(string.Format("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                        return;
                    }
                    if (webReturn.ListData == null)
                    {
                        ShowException(string.Format("ListData is null."));
                        return;
                    }
                    int count = 0;
                    for (int j = 0; j < webReturn.ListData.Count; j++)
                    {
                        string strInfo = webReturn.ListData[j];

                        optReturn = XMLHelper.DeserializeObject <ResourceObject>(strInfo);
                        if (!optReturn.Result)
                        {
                            ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                            return;
                        }
                        ResourceObject obj = optReturn.Data as ResourceObject;
                        if (obj == null)
                        {
                            ShowException(string.Format("ResourceObject is null."));
                            return;
                        }
                        mListChannelObjects.Add(obj);
                        count++;
                    }

                    CurrentApp.WriteLog("LoadChannelObjects", string.Format("End.\t{0}\t{1}", voiceObjID, count));
                }
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
Example #2
0
 private void LoadDriverList()
 {
     try
     {
         if (ServerItem == null)
         {
             return;
         }
         var serverInfo = ServerItem.Info;
         if (serverInfo == null)
         {
             return;
         }
         string     strAddress = serverInfo.FullName;
         WebRequest webRequest = new WebRequest();
         webRequest.Session = CurrentApp.Session;
         webRequest.Code    = (int)S2106Codes.GetDiskDriverList;
         webRequest.ListData.Add(CurrentApp.Session.UserInfo.UserID.ToString());
         webRequest.ListData.Add(strAddress);
         Service21061Client client = new Service21061Client(
             WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
             WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service21061"));
         WebReturn webReturn = client.DoOperation(webRequest);
         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;
         }
         for (int i = 0; i < webReturn.ListData.Count; i++)
         {
             string   strInfo = webReturn.ListData[i];
             string[] arrInfo = strInfo.Split(new[] { ConstValue.SPLITER_CHAR }, StringSplitOptions.None);
             if (arrInfo.Length < 2)
             {
                 continue;
             }
             DirInfo dirInfo = new DirInfo();
             dirInfo.Name = arrInfo[0];
             dirInfo.Path = arrInfo[0] + "\\";
             ObjectItem item = new ObjectItem();
             item.Data = dirInfo;
             item.Name = dirInfo.Name;
             item.Icon = "/UMPS2106;component/Themes/Default/UMPS2106/Images/00006.png";
             Dispatcher.Invoke(new Action(() => mRootItem.AddChild(item)));
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }