Exemplo n.º 1
0
        private void ExecuteLoginCommand()
        {
            Message = null;
            IsBusy  = true;

            Action act = () =>
            {
                if (RememberPassword || AutoLogin)
                {
                    IsolatedStorageHelper.Save(LocalData.Transfer(this));
                }
                else if (!RememberPassword)
                {
                    IsolatedStorageHelper.Delete <LocalData>();
                }

                CommunicateManager.Invoke <ILoginService>(p =>
                {
                    var token           = p.Login(Num, LoginName, LoginPwd);
                    LoginInfo.Token     = token;
                    LoginInfo.Code      = Num.Trim();
                    LoginInfo.Account   = LoginName.Trim();
                    LoginInfo.Guid      = Guid.NewGuid();
                    LoginInfo.IsLogined = true;
                    //登录成功
                    IsLogined = true;
                }, ShowErr);
            };

            Task.Factory.StartNew(act).ContinueWith(task =>
            {
                CommunicateManager.StartPushMessage();
                InvokeSetBusy(false);
            });
        }
Exemplo n.º 2
0
        private void OnContextMenuDeleteClick(object sender, RoutedEventArgs e)
        {
            if (SelectedItem != null)
            {
                var item = (from i in ViewModel.Children where i.Guid == SelectedItem.Guid select i).FirstOrDefault();

                var result = MessageBox.Show(String.Format(Globals.ConfirmationMessageDelete, SelectedItem.Name), Globals.ConfirmationMessageCaptionDelete, MessageBoxButton.OKCancel);
                if (result == MessageBoxResult.OK)
                {
                    IsolatedStorageHelper.Delete(item);
                    ViewModel.Load();
                    ChildrenListBox.DataContext = ViewModel.Children;
                }
            }
            else
            {
                MessageBox.Show(Globals.ErrorMessageDelete);
            }
        }