Welcome.xaml.cs
上传用户:jxqhsy
上传日期:2020-12-31
资源大小:1793k
文件大小:2k
源码类别:

SilverLight

开发平台:

HTML/CSS

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Net;
  5. using System.Windows;
  6. using System.Windows.Controls;
  7. using System.Windows.Documents;
  8. using System.Windows.Input;
  9. using System.Windows.Media;
  10. using System.Windows.Media.Animation;
  11. using System.Windows.Shapes;
  12. namespace SFGS
  13. {
  14.     public partial class Welcome : UserControl
  15.     {
  16.         private string SurveyID = "";
  17.         public Welcome()
  18.         {
  19.             InitializeComponent();
  20.             UpdateTheCurrentSurvey();
  21.         }
  22.         private void UpdateTheCurrentSurvey()
  23.         {
  24.             WebServiceProxy.UserManageSoapClient userManageSoapClient = new SFGS.WebServiceProxy.UserManageSoapClient();
  25.             userManageSoapClient.ReadAllSurveyAsync();
  26.             userManageSoapClient.ReadAllSurveyCompleted += new EventHandler<SFGS.WebServiceProxy.ReadAllSurveyCompletedEventArgs>(userMgrSoapClient_ReadAllSurveyCompleted);
  27.         }
  28.         private void userMgrSoapClient_ReadAllSurveyCompleted(object sender, SFGS.WebServiceProxy.ReadAllSurveyCompletedEventArgs e)
  29.         {
  30.             List<Customer> theSurveyList;
  31.             if (!e.Result.Equals(""))
  32.             {
  33.                 theSurveyList = Global.getList(e.Result);
  34.                 foreach (Customer ctm in theSurveyList)
  35.                 {
  36.                    if (ctm.IsCurrentSurvey=="1")
  37.                    {
  38.                        this.SurveyName.Content = ctm.Name;
  39.                        this.txtContent.Text = ctm.Description;
  40.                        this.SurveyID = ctm.ID;
  41.                        break;
  42.                    }
  43.                 }
  44.             }
  45.             else
  46.             {
  47.                 this.SurveyName.Content = "No Content";
  48.                 this.txtContent.Text = "No Content";
  49.             }
  50.         }
  51.         private void takeSurvey_Click(object sender, RoutedEventArgs e)
  52.         {
  53.             // TODO: 在此添加调用做题页面
  54.             Survey survey = new Survey(this.SurveyID);
  55.             survey.Width = 960;
  56.             survey.Height = 700;            
  57.             (Parent as Canvas).Children.Add(survey);
  58.             (Parent as Canvas).Children.Remove(this);
  59.         }
  60.     }
  61. }