1 | // Copyright © SixtyFPS GmbH <info@slint.dev> |
2 | // SPDX-License-Identifier: MIT |
3 | use slint::{Timer, TimerMode}; |
4 | |
5 | slint::slint!(import { MainWindow } from "timer.slint" ;); |
6 | |
7 | pub fn main() { |
8 | let main_window = MainWindow::new().unwrap(); |
9 | let timer: Timer = Timer::default(); |
10 | { |
11 | let main_window_weak = main_window.as_weak(); |
12 | timer.start(mode:TimerMode::Repeated, interval:std::time::Duration::from_millis(10), callback:move || { |
13 | let main_window = main_window_weak.unwrap(); |
14 | main_window.invoke_tick(10); |
15 | }); |
16 | } |
17 | main_window.run().unwrap(); |
18 | } |
19 | |