Пример #1
0
 public async Task <IActionResult> Basic(BasicEdit from, IFormFile file)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             SetMessager(MessageType.success, ModelState.FirstErrorMessage());
             return(RedirectToAction("Index"));
         }
         string headImg = null;
         if (file != null)
         {
             headImg = $"/headImgs/headImg_{DateTime.Now.Ticks.ToString()}.{Path.GetExtension(file.FileName)}";
             await FileExtension.Upload(file, ServerUtility.ContentRootMapPath(headImg));
         }
         _accountService.ChangeBasic(FullAccount.Id, from.RealName, from.Email, headImg);
         SetMessager(MessageType.success, "修改基本信息成功");
     }
     catch (System.Exception ex)
     {
         LogUtility.Account.Error(ex.Message, ex);
         SetMessager(MessageType.success, "修改基本信息失败");
     }
     return(RedirectToAction("Index"));
 }
Пример #2
0
        public static void Setup(TestContext context)
        {
            Do.Launch(TestData.ApplicationPath).And.Wait(1000);
            _mainWindow = WindowFinder.Search(Use.AutomationId(TestData.MainWindowAutomationId));
            var currentButton = UI.GetChild <BasicButton>(By.AutomationId("CUI_KeyboardExTests_Button"), From.Element(_mainWindow));

            currentButton.Unsafe.Click();
            DynamicSleep.Wait(1000);
            _testWindow = WindowFinder.Search(Use.AutomationId("CUI_KeyboardExTestsWindow"), And.NoAssert());
            _textBox    = UI.GetChild <BasicEdit>(By.AutomationId("CUI_InputTextBox"), From.Element(_testWindow));
        }
Пример #3
0
        public void TypeKey_AltF4OnTheWindow_ClosesTheWindow()
        {
            KeyboardEx.TypeKey(_testWindow, Key.F4, ModifierKeys.Alt).And.Wait(2000);

            var testWindow = WindowFinder.Search(Use.AutomationId("CUI_KeyboardExTestsWindow"), And.NoAssert().And.Timeout(2000));

            Assert.IsNull(testWindow);
            var currentButton = UI.GetChild <BasicButton>(By.AutomationId("CUI_KeyboardExTests_Button"), From.Element(_mainWindow));

            currentButton.Unsafe.Click();
            DynamicSleep.Wait(1000);
            _testWindow = WindowFinder.Search(Use.AutomationId("CUI_KeyboardExTestsWindow"), And.NoAssert());
            _textBox    = UI.GetChild <BasicEdit>(By.AutomationId("CUI_InputTextBox"), From.Element(_testWindow));
        }