Exemplo n.º 1
0
        public BDWMInterest()
        {
            InitializeComponent();

            dt.Columns.Add("id", typeof(Int32));
            dt.Columns.Add("name", typeof(string));
            dgQueryResult.ItemsSource = dt.DefaultView;

            AuthHeader h = new AuthHeader();

            //读取
            if (File.Exists(strFilePath))//读取时先要判读INI文件是否存在
            {
                strSec     = System.IO.Path.GetFileNameWithoutExtension(strFilePath);
                h.username = ContentValue(strSec, "Username");
                h.password = Common.DecryptDES(ContentValue(strSec, "Password"), "WpfQuery");//ContentValue(strSec, "Password");
                h.token    = ContentValue(strSec, "Token");
            }
            else
            {
                MessageBox.Show("account.ini文件不存在");
                return;
            }
            InterestServiceClient client = new InterestServiceClient();

            InterestType[] response;
            ResHeader      resHeader = client.getInterest(h, out response);

            foreach (var ba in response)
            {
                dt.Rows.Add(ba.interestId, ba.interestName);
            }
        }
        public static void getInterest()
        {
            InterestServiceClient service = new InterestServiceClient();

            AuthHeader authHeader = new AuthHeader();

            HeaderUtil.loadHeader(authHeader);

            InterestType[] interestTypes = null;

            ResHeader resHeader = service.getInterest(authHeader, out interestTypes);

            Console.WriteLine("InterestService.getInterest(): ");
            ObjectDumper.WriteResponse(resHeader, interestTypes);
        }