chore: update view codes in vm

dev_ocr_translate
DESKTOP-3BO4HSG\ksat 2 years ago
parent 5c76a1df83
commit b08b5de6ff

@ -101,7 +101,6 @@
<!--input--> <!--input-->
<Grid x:Name="Input" <Grid x:Name="Input"
Grid.Row="1" Grid.Row="1"
FocusManager.FocusedElement="{Binding ElementName=TextBoxInput}"
Margin="10,0,10,0"> Margin="10,0,10,0">
<!--输入框--> <!--输入框-->
<Border x:Name="BorderInput" <Border x:Name="BorderInput"

@ -191,6 +191,8 @@ namespace STranslate.ViewModel
{ {
Mainwin.Show(); Mainwin.Show();
Mainwin.Activate(); Mainwin.Activate();
//TODO: need to deal with this
//TextBoxInput.Focus();
(Mainwin.FindName("TextBoxInput") as System.Windows.Controls.TextBox).Focus(); (Mainwin.FindName("TextBoxInput") as System.Windows.Controls.TextBox).Focus();
} }
/// <summary> /// <summary>
@ -209,8 +211,7 @@ namespace STranslate.ViewModel
ClearAll(); ClearAll();
var sentence = GetWordsHelper.Get(); var sentence = GetWordsHelper.Get();
OpenMainWin(); OpenMainWin();
(Mainwin.FindName("TextBoxInput") as System.Windows.Controls.TextBox) InputTxt = sentence.Trim();
.Text = sentence.Trim();
_ = Translate(); _ = Translate();
} }
/// <summary> /// <summary>
@ -228,7 +229,7 @@ namespace STranslate.ViewModel
public void ScreenShotTranslateEx(string text) public void ScreenShotTranslateEx(string text)
{ {
InputTranslate(); InputTranslate();
(Mainwin.FindName("TextBoxInput") as System.Windows.Controls.TextBox).Text = text; InputTxt = text;
_ = Translate(); _ = Translate();
} }

Loading…
Cancel
Save