mirror of
https://github.com/Myxelium/Bridge-Multi.git
synced 2026-04-11 14:19:38 +00:00
55 lines
1.3 KiB
TypeScript
55 lines
1.3 KiB
TypeScript
import { ChangeDetectorRef, Component, OnInit } from '@angular/core'
|
|
|
|
@Component({
|
|
selector: 'app-toolbar',
|
|
templateUrl: './toolbar.component.html',
|
|
styleUrls: ['./toolbar.component.scss'],
|
|
})
|
|
export class ToolbarComponent implements OnInit {
|
|
|
|
isMaximized: boolean
|
|
updateAvailable: boolean | null = false
|
|
|
|
constructor(private ref: ChangeDetectorRef) { }
|
|
|
|
async ngOnInit() {
|
|
this.isMaximized = await window.electron.invoke.isMaximized()
|
|
window.electron.on.minimized(() => {
|
|
this.isMaximized = false
|
|
this.ref.detectChanges()
|
|
})
|
|
window.electron.on.maximized(() => {
|
|
this.isMaximized = true
|
|
this.ref.detectChanges()
|
|
})
|
|
|
|
window.electron.on.updateAvailable(result => {
|
|
this.updateAvailable = result !== null
|
|
this.ref.detectChanges()
|
|
})
|
|
window.electron.on.updateError(() => {
|
|
this.updateAvailable = null
|
|
this.ref.detectChanges()
|
|
})
|
|
this.updateAvailable = await window.electron.invoke.getUpdateAvailable()
|
|
this.ref.detectChanges()
|
|
}
|
|
|
|
minimize() {
|
|
window.electron.emit.minimize()
|
|
}
|
|
|
|
async toggleMaximized() {
|
|
if (await window.electron.invoke.isMaximized()) {
|
|
window.electron.emit.restore()
|
|
} else {
|
|
window.electron.emit.maximize()
|
|
}
|
|
this.isMaximized = !this.isMaximized
|
|
}
|
|
|
|
close() {
|
|
window.electron.emit.quit()
|
|
}
|
|
}
|