Add MainViewModel.ps1
This commit is contained in:
@@ -0,0 +1,48 @@
|
|||||||
|
class MainViewModel : FirefoxAddinManager.ObservableBase {
|
||||||
|
|
||||||
|
[DeployViewModel] $Deploy
|
||||||
|
[DiagnosticViewModel] $Diagnostic
|
||||||
|
|
||||||
|
hidden [string] $_firefoxPath = ""
|
||||||
|
hidden [string] $_statusBar = ""
|
||||||
|
hidden [bool] $_isAdmin = $false
|
||||||
|
hidden [bool] $_isIntune = $false
|
||||||
|
|
||||||
|
[string] $FirefoxPath {
|
||||||
|
get { return $this._firefoxPath }
|
||||||
|
set { $this._firefoxPath = $value; $this.OnPropertyChanged("FirefoxPath") }
|
||||||
|
}
|
||||||
|
|
||||||
|
[string] $StatusBar {
|
||||||
|
get { return $this._statusBar }
|
||||||
|
set { $this._statusBar = $value; $this.OnPropertyChanged("StatusBar") }
|
||||||
|
}
|
||||||
|
|
||||||
|
[bool] $IsAdmin {
|
||||||
|
get { return $this._isAdmin }
|
||||||
|
set { $this._isAdmin = $value; $this.OnPropertyChanged("IsAdmin") }
|
||||||
|
}
|
||||||
|
|
||||||
|
[bool] $IsIntune {
|
||||||
|
get { return $this._isIntune }
|
||||||
|
set { $this._isIntune = $value; $this.OnPropertyChanged("IsIntune") }
|
||||||
|
}
|
||||||
|
|
||||||
|
[string] AdminLabel {
|
||||||
|
get { return if ($this.IsAdmin) { "Administrator-Modus aktiv" } else { "KEIN Admin - eingeschraenkte Funktionen" } }
|
||||||
|
}
|
||||||
|
|
||||||
|
[string] IntuneLabel {
|
||||||
|
get { return if ($this.IsIntune) { "Intune: erkannt" } else { "Intune: nicht erkannt" } }
|
||||||
|
}
|
||||||
|
|
||||||
|
MainViewModel() {
|
||||||
|
$this.Deploy = [DeployViewModel]::new()
|
||||||
|
$this.Diagnostic = [DiagnosticViewModel]::new()
|
||||||
|
$this.IsAdmin = [FirefoxService]::IsAdmin()
|
||||||
|
$this.IsIntune = [FirefoxService]::IsIntuneManaged()
|
||||||
|
$ffDir = [FirefoxService]::FindInstallDir()
|
||||||
|
$this.FirefoxPath = if ($ffDir) { $ffDir } else { "Firefox nicht gefunden" }
|
||||||
|
$this.StatusBar = "Firefox: $($this.FirefoxPath) | $($this.AdminLabel) | $($this.IntuneLabel)"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user