Ejemplo n.º 1
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            if (userpassword.Password != passwordConfirm.Password)
            {
                MainWindow mainWindow = MainWindow.GetInstance();
                mainWindow.notifyIcon.BalloonTipTitle = Env.PROJECT_NAME;
                mainWindow.notifyIcon.BalloonTipText  = "两次密码输入不一致";
                mainWindow.notifyIcon.ShowBalloonTip(1);
            }
            else
            {
                UserRegisterRequest    userRegister  = new UserRegisterRequest(userName.Text, userpassword.Password, signature.Text);
                RestfulClient <string> restfulClient = new RestfulClient <string>(userRegister);
                string userId = await restfulClient.GetResponse();

                if (userId != null)
                {
                    MainWindow mainWindow = MainWindow.GetInstance();

                    mainWindow.notifyIcon.BalloonTipTitle = Env.PROJECT_NAME;
                    mainWindow.notifyIcon.BalloonTipText  = "注册成功";
                    mainWindow.notifyIcon.ShowBalloonTip(1);
                    UserMain.GetInstance().Close();
                    MainWindow.GetInstance().Show();
                }
            }
        }
Ejemplo n.º 2
0
        private async void loadDataAsync()
        {
            RestfulClient <List <CalendarModel> > recommendListRest = new RestfulClient <List <CalendarModel> >("/piazza/most-subscribed");

            recommendListRest.AddParameter("size", "500");
            RestfulClient <List <CalendarModel> > allListRest = new RestfulClient <List <CalendarModel> >("/piazza/all");

            allListRest.AddParameter("size", "500");
            this.recommendListData = await recommendListRest.GetResponse();

            this.allListData = await allListRest.GetResponse();

            Console.Write("ended");

            Console.Write(allListData[0]);
            for (int i = 0; i < this.recommendListData.Count; i++)
            {
                this.recommendList.Items.Add(new SqureCard(recommendListData[i]));
            }

            for (int i = 0; i < this.allListData.Count; i++)
            {
                this.allList.Items.Add(new SqureCard(allListData[i]));
            }
        }
Ejemplo n.º 3
0
        private async void getCreated()
        {
            RestfulClient <List <TodayResponse> > restful = new RestfulClient <List <TodayResponse> >("/custom/created");

            this.created = await restful.GetResponse();

            createCount.Content = this.created.Count;
        }
Ejemplo n.º 4
0
 private void btn_comment_Click(object sender, RoutedEventArgs e)
 {
     if (!edit_content.Text.Equals(""))
     {
         AddCommentRequest      request       = new AddCommentRequest(calendarId, edit_content.Text);
         RestfulClient <String> detailRestful = new RestfulClient <String>(request);
         detailRestful.GetResponse();
         initCommentViewAsync();
     }
 }
Ejemplo n.º 5
0
        private async Task initDetailView()
        {
            DetailRequest detailRequest = new DetailRequest(calendarId);
            RestfulClient <DetailResponse> detailRestful = new RestfulClient <DetailResponse>(detailRequest);

            detailResponse = await detailRestful.GetResponse();

            this.img_picture.Source = new BitmapImage(new Uri(detailResponse.picture, UriKind.Absolute));
            txt_author.Content      = detailResponse.creatorName;
            txt_content.Content     = detailResponse.description;
            txt_title.Content       = detailResponse.title;
        }
Ejemplo n.º 6
0
        private async Task initCommentViewAsync()
        {
            GetComment commentRequest = new GetComment(calendarId);
            RestfulClient <List <CommentModel> > commentRestful = new RestfulClient <List <CommentModel> >(commentRequest);

            comment = await commentRestful.GetResponse();

            lv_comment.Items.Clear();
            for (int i = 0; i < comment.Count; i++)
            {
                lv_comment.Items.Add(new CommentItem(comment[i].userName, comment[i].comment, "2018-1-1", comment[i].userAvatar));
            }
        }
Ejemplo n.º 7
0
        public async void loadTodayList()
        {
            // 列表的请求

            GetSubscribedToday request = new GetSubscribedToday();
            RestfulClient <List <TodayResponse> > restful = new RestfulClient <List <TodayResponse> >(request);

            List <TodayResponse> rsp = await restful.GetResponse();

            if (rsp != null)
            {
                this.tList = rsp;
                refresh();
            }
        }
Ejemplo n.º 8
0
        public async void loadToday(long calendarId)
        {
            // 单个黄历信息的请求

            GetTodayById request = new GetTodayById(calendarId);
            RestfulClient <TodayResponse> restful = new RestfulClient <TodayResponse>(request);

            TodayResponse rsp = await restful.GetResponse();

            if (rsp != null)
            {
                this.tResponse = rsp;
                refresh();
            }
        }
Ejemplo n.º 9
0
 private void btn_subscribe_Click(object sender, RoutedEventArgs e)
 {
     if (btn_subscribe.Content.ToString() == "未订阅")
     {
         SubscribeRequest       subscribeRequest = new SubscribeRequest(calendarId);
         RestfulClient <String> request          = new RestfulClient <String>(subscribeRequest);
         request.GetResponse();
         btn_subscribe.Content = "已订阅";
     }
     else
     {
         UnsubscribeReques      unsubscribeRequest = new UnsubscribeReques(calendarId);
         RestfulClient <String> request            = new RestfulClient <String>(unsubscribeRequest);
         request.GetResponse();
         btn_subscribe.Content = "未订阅";
     }
 }
Ejemplo n.º 10
0
        private async void loadDataAsync()
        {
            RestfulClient <List <TodayResponse> > subListRest = new RestfulClient <List <TodayResponse> >("/calendar/subscribed");

            subListRest.AddParameter("size", "500");


            this.subscribeListData = await subListRest.GetResponse();

            Console.WriteLine(subscribeListData.Count);
            for (int i = 0; i < this.subscribeListData.Count; i++)
            {
                if (subscribeListData[i].calendarPicture != null)
                {
                    this.subscribeList.Items.Add(new SqureCard(subscribeListData[i]));
                }
            }
        }
Ejemplo n.º 11
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            UserLoginRequest userLoginRequest         = new UserLoginRequest(txtUserName.Text, txtPassword.Password);
            RestfulClient <UserLoginResponse> restful = new RestfulClient <UserLoginResponse>(userLoginRequest);

            UserLoginResponse response = await restful.GetResponse();

            if (response != null)
            {
                ShowSystemNotice("Today", "登录成功,欢迎 " + response.user.name, 10);
                IFormatter formatter = new BinaryFormatter();

                Stream stream = new FileStream("./user.me", FileMode.OpenOrCreate, FileAccess.Write, FileShare.None);
                formatter.Serialize(stream, response);
                stream.Close();

                this.Hide();
                new NewMasterWindow().Show();
            }
        }