|
|
@ -62,6 +62,36 @@ namespace STranslate.ViewModel
|
|
|
|
ExitApp();
|
|
|
|
ExitApp();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//置顶
|
|
|
|
|
|
|
|
TopmostCmd = new RelayCommand((_) => true, (_) =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (IsTopmost)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
(_Mainwin.FindName("TopmostBtn") as System.Windows.Controls.Button)
|
|
|
|
|
|
|
|
.SetResourceReference(System.Windows.Controls.Control.TemplateProperty, _UnTopmostTemplateName);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
(_Mainwin.FindName("TopmostBtn") as System.Windows.Controls.Button)
|
|
|
|
|
|
|
|
.SetResourceReference(System.Windows.Controls.Control.TemplateProperty, _TopmostTemplateName);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
IsTopmost = !IsTopmost;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//ESC
|
|
|
|
|
|
|
|
EscCmd = new RelayCommand((_) => true, (_) =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_Mainwin.Hide();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//取消置顶
|
|
|
|
|
|
|
|
if (IsTopmost)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
(_Mainwin.FindName("TopmostBtn") as System.Windows.Controls.Button)
|
|
|
|
|
|
|
|
.SetResourceReference(System.Windows.Controls.Control.TemplateProperty, _UnTopmostTemplateName);
|
|
|
|
|
|
|
|
IsTopmost = !IsTopmost;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Common
|
|
|
|
#region Common
|
|
|
@ -141,7 +171,7 @@ namespace STranslate.ViewModel
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_Mainwin.Show();
|
|
|
|
_Mainwin.Show();
|
|
|
|
_Mainwin.Activate();
|
|
|
|
_Mainwin.Activate();
|
|
|
|
//TODO: add textbox focus
|
|
|
|
(_Mainwin.FindName("TextBoxInput") as System.Windows.Controls.TextBox).Focus();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public void InputTranslate()
|
|
|
|
public void InputTranslate()
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -153,8 +183,8 @@ namespace STranslate.ViewModel
|
|
|
|
ClearAll();
|
|
|
|
ClearAll();
|
|
|
|
var sentence = GetWordsHelper.Get();
|
|
|
|
var sentence = GetWordsHelper.Get();
|
|
|
|
OpenMainWin();
|
|
|
|
OpenMainWin();
|
|
|
|
//TODO: add textbox focus
|
|
|
|
(_Mainwin.FindName("TextBoxInput") as System.Windows.Controls.TextBox)
|
|
|
|
//this.TextBoxInput.Text = sentence.Trim();
|
|
|
|
.Text = sentence.Trim();
|
|
|
|
_ = Translate();
|
|
|
|
_ = Translate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public void ExitApp()
|
|
|
|
public void ExitApp()
|
|
|
@ -344,6 +374,8 @@ namespace STranslate.ViewModel
|
|
|
|
public ICommand ShowMainWinCmd { get; private set; }
|
|
|
|
public ICommand ShowMainWinCmd { get; private set; }
|
|
|
|
public ICommand StartupCmd { get; private set; }
|
|
|
|
public ICommand StartupCmd { get; private set; }
|
|
|
|
public ICommand ExitCmd { get; private set; }
|
|
|
|
public ICommand ExitCmd { get; private set; }
|
|
|
|
|
|
|
|
public ICommand TopmostCmd { get; private set; }
|
|
|
|
|
|
|
|
public ICommand EscCmd { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 是否开机自启
|
|
|
|
/// 是否开机自启
|
|
|
@ -354,6 +386,9 @@ namespace STranslate.ViewModel
|
|
|
|
public bool IsVisibility { get => _IsVisibility; set => UpdateProperty(ref _IsVisibility, value); }
|
|
|
|
public bool IsVisibility { get => _IsVisibility; set => UpdateProperty(ref _IsVisibility, value); }
|
|
|
|
|
|
|
|
|
|
|
|
private MainWindow _Mainwin;
|
|
|
|
private MainWindow _Mainwin;
|
|
|
|
|
|
|
|
public bool IsTopmost { get; set; }
|
|
|
|
|
|
|
|
private readonly string _TopmostTemplateName = "ButtonTemplateTopmost";
|
|
|
|
|
|
|
|
private readonly string _UnTopmostTemplateName = "ButtonTemplateUnTopmost";
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 全局配置文件
|
|
|
|
/// 全局配置文件
|
|
|
|