windows replace uni with cmd to start up main window after installation (#8235)
This is to avoid uni link not working Other change: The install window now has the title "appname - Install" to distinguish it from the main application window. Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
ed5487a1fc
commit
18464ec570
@ -338,7 +338,6 @@ void runInstallPage() async {
|
|||||||
windowManager.focus();
|
windowManager.focus();
|
||||||
windowManager.setOpacity(1);
|
windowManager.setOpacity(1);
|
||||||
windowManager.setAlignment(Alignment.center); // ensure
|
windowManager.setAlignment(Alignment.center); // ensure
|
||||||
windowManager.setTitle(getWindowName());
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,15 +116,27 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
|
|||||||
if (!command_line_arguments.empty() && command_line_arguments.front().compare(0, cmParam.size(), cmParam.c_str()) == 0) {
|
if (!command_line_arguments.empty() && command_line_arguments.front().compare(0, cmParam.size(), cmParam.c_str()) == 0) {
|
||||||
is_cm_page = true;
|
is_cm_page = true;
|
||||||
}
|
}
|
||||||
|
bool is_install_page = false;
|
||||||
|
auto installParam = std::string("--install");
|
||||||
|
if (!command_line_arguments.empty() && command_line_arguments.front().compare(0, installParam.size(), installParam.c_str()) == 0) {
|
||||||
|
is_install_page = true;
|
||||||
|
}
|
||||||
|
|
||||||
command_line_arguments.insert(command_line_arguments.end(), rust_args.begin(), rust_args.end());
|
command_line_arguments.insert(command_line_arguments.end(), rust_args.begin(), rust_args.end());
|
||||||
project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
|
project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
|
||||||
|
|
||||||
FlutterWindow window(project);
|
FlutterWindow window(project);
|
||||||
Win32Window::Point origin(10, 10);
|
Win32Window::Point origin(10, 10);
|
||||||
Win32Window::Size size(800, 600);
|
Win32Window::Size size(800, 600);
|
||||||
if (!window.CreateAndShow(
|
std::wstring window_title;
|
||||||
is_cm_page ? app_name + L" - Connection Manager" : app_name, origin,
|
if (is_cm_page) {
|
||||||
size, !is_cm_page)) {
|
window_title = app_name + L" - Connection Manager";
|
||||||
|
} else if (is_install_page) {
|
||||||
|
window_title = app_name + L" - Install";
|
||||||
|
} else {
|
||||||
|
window_title = app_name;
|
||||||
|
}
|
||||||
|
if (!window.CreateAndShow(window_title, origin, size, !is_cm_page)) {
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
window.SetQuitOnClose(true);
|
window.SetQuitOnClose(true);
|
||||||
|
@ -2185,12 +2185,10 @@ sc start {app_name}
|
|||||||
|
|
||||||
fn run_after_run_cmds(silent: bool) {
|
fn run_after_run_cmds(silent: bool) {
|
||||||
let (_, _, _, exe) = get_install_info();
|
let (_, _, _, exe) = get_install_info();
|
||||||
let app = crate::get_app_name().to_lowercase();
|
|
||||||
if !silent {
|
if !silent {
|
||||||
log::debug!("Spawn new window");
|
log::debug!("Spawn new window");
|
||||||
allow_err!(std::process::Command::new("cmd")
|
allow_err!(std::process::Command::new("cmd")
|
||||||
.arg("/c")
|
.args(&["/c", "timeout", "/t", "2", "&", &format!("{exe}")])
|
||||||
.arg(format!("timeout /t 2 & start {app}://"))
|
|
||||||
.creation_flags(winapi::um::winbase::CREATE_NO_WINDOW)
|
.creation_flags(winapi::um::winbase::CREATE_NO_WINDOW)
|
||||||
.spawn());
|
.spawn());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user