public InstallerMainWindow(Installer installer) { Opacity = 0; Installer = installer; InitializeComponent(); CloseOption.IsChecked = (CoApp.Toolkit.Configuration.RegistryView.CoAppUser["Preferences", "Autoclose"].BoolValue); OrganizationName.SetBinding(TextBlock.TextProperty, new Binding("Organization") { Source = Installer }); ProductName.SetBinding(TextBlock.TextProperty, new Binding("Product") { Source = Installer }); // package icon disabled until after RC // PackageIcon.SetBinding(Image.SourceProperty, new Binding("PackageIcon") { Source = Installer }); DescriptionText.SetBinding(TextBlock.TextProperty, new Binding("Description") { Source = Installer }); WhichVersionToInstall.SetBinding(ItemsControl.ItemsSourceProperty, new Binding("InstallChoices") { Source = Installer }); WhichVersionToInstall.DisplayMemberPath = "Value"; WhichVersionToInstall.SelectedValuePath = "Package"; WhichVersionToInstall.SetBinding(Selector.SelectedValueProperty, new Binding("SelectedPackage") { Source = Installer }); WhichVersionToInstall.SelectedIndex = 0; ProductVersion.SetBinding(TextBlock.TextProperty, new Binding("ProductVersion") { Source = Installer }); InstallButton.SetBinding(IsEnabledProperty, new Binding("ReadyToInstall") { Source = Installer }); InstallButton.SetBinding(ToolTipProperty, new Binding("InstallButtonText") { Source = Installer }); InstallText.SetBinding(TextBlock.TextProperty, new Binding("InstallButtonText") { Source = Installer }); RemoveButton.SetBinding(VisibilityProperty, new Binding("RemoveButtonVisibility") { Source = Installer }); RemoveAdvanced.SetBinding(VisibilityProperty, new Binding("RemoveButtonVisibility") { Source = Installer }); InstallationProgress.SetBinding(RangeBase.ValueProperty, new Binding("Progress") { Source = Installer }); CancelButton.SetBinding(VisibilityProperty, new Binding("CancelButtonVisibility") { Source = Installer }); CancelText.SetBinding(TextBlock.TextProperty, new Binding("CancelButtonText") { Source = Installer }); StatusText.SetBinding(TextBlock.TextProperty, new Binding("StatusText") { Source = Installer }); RemoveContextMenu.SetBinding(ItemsControl.ItemsSourceProperty, new Binding("RemoveChoices") { Source = Installer }); try { VisibilityAnimation.SetAnimationType(RemoveButton, VisibilityAnimation.AnimationType.Fade); VisibilityAnimation.SetAnimationType(InstallButton, VisibilityAnimation.AnimationType.Fade); VisibilityAnimation.SetAnimationType(InstallationProgress, VisibilityAnimation.AnimationType.Fade); VisibilityAnimation.SetAnimationType(StatusText, VisibilityAnimation.AnimationType.Fade); VisibilityAnimation.SetAnimationType(CloseOption, VisibilityAnimation.AnimationType.Fade); VisibilityAnimation.SetAnimationType(WhichVersionToInstall, VisibilityAnimation.AnimationType.Fade); VisibilityAnimation.SetAnimationType(CancelButton, VisibilityAnimation.AnimationType.Fade); } catch { } Loaded += (x, y) => { Installer.Ping = true; ShowInTaskbar = true; Topmost = false; ((Storyboard)FindResource("showWindow")).Begin(); if (WhichVersionToInstall.Items.Count == 0) { WhichVersionToInstall.Visibility = Visibility.Hidden; } else { if (WhichVersionToInstall.SelectedIndex == -1) { WhichVersionToInstall.SelectedIndex = 0; } } }; Installer.Finished += (src, evnt) => Invoke(() => { if (Installer.Passive || (CoApp.Toolkit.Configuration.RegistryView.CoAppUser["Preferences", "Autoclose"].BoolValue)) { ActuallyClose(); } else { WaitForClose(); } }); }
public InstallerMainWindow(Installer installer) { Opacity = 0; Installer = installer; InitializeComponent(); CloseOption.IsChecked = (CoApp.Toolkit.Configuration.RegistryView.CoAppUser["Preferences", "Autoclose"].BoolValue); OrganizationName.SetBinding(TextBlock.TextProperty, new Binding("Organization") {Source = Installer}); ProductName.SetBinding(TextBlock.TextProperty, new Binding("Product") {Source = Installer}); // package icon disabled until after RC // PackageIcon.SetBinding(Image.SourceProperty, new Binding("PackageIcon") { Source = Installer }); DescriptionText.SetBinding(TextBlock.TextProperty, new Binding("Description") {Source = Installer}); WhichVersionToInstall.SetBinding(ItemsControl.ItemsSourceProperty, new Binding("InstallChoices") {Source = Installer}); WhichVersionToInstall.DisplayMemberPath = "Value"; WhichVersionToInstall.SelectedValuePath = "Package"; WhichVersionToInstall.SetBinding(Selector.SelectedValueProperty, new Binding("SelectedPackage") {Source = Installer}); WhichVersionToInstall.SelectedIndex = 0; ProductVersion.SetBinding(TextBlock.TextProperty, new Binding("ProductVersion") {Source = Installer}); InstallButton.SetBinding(IsEnabledProperty, new Binding("ReadyToInstall") {Source = Installer}); InstallButton.SetBinding(ToolTipProperty, new Binding("InstallButtonText") {Source = Installer}); InstallText.SetBinding(TextBlock.TextProperty, new Binding("InstallButtonText") {Source = Installer}); RemoveButton.SetBinding(VisibilityProperty, new Binding("RemoveButtonVisibility") {Source = Installer}); RemoveAdvanced.SetBinding(VisibilityProperty, new Binding("RemoveButtonVisibility") {Source = Installer}); InstallationProgress.SetBinding(RangeBase.ValueProperty, new Binding("Progress") {Source = Installer}); CancelButton.SetBinding(VisibilityProperty, new Binding("CancelButtonVisibility") {Source = Installer}); CancelText.SetBinding(TextBlock.TextProperty, new Binding("CancelButtonText") { Source = Installer }); StatusText.SetBinding(TextBlock.TextProperty, new Binding("StatusText") { Source = Installer }); RemoveContextMenu.SetBinding(ItemsControl.ItemsSourceProperty, new Binding("RemoveChoices") {Source = Installer}); try { VisibilityAnimation.SetAnimationType(RemoveButton, VisibilityAnimation.AnimationType.Fade); VisibilityAnimation.SetAnimationType(InstallButton, VisibilityAnimation.AnimationType.Fade); VisibilityAnimation.SetAnimationType(InstallationProgress, VisibilityAnimation.AnimationType.Fade); VisibilityAnimation.SetAnimationType(StatusText, VisibilityAnimation.AnimationType.Fade); VisibilityAnimation.SetAnimationType(CloseOption, VisibilityAnimation.AnimationType.Fade); VisibilityAnimation.SetAnimationType(WhichVersionToInstall, VisibilityAnimation.AnimationType.Fade); VisibilityAnimation.SetAnimationType(CancelButton, VisibilityAnimation.AnimationType.Fade); } catch { } Loaded += (x, y) => { Installer.Ping = true; ShowInTaskbar = true; Topmost = false; ((Storyboard)FindResource("showWindow")).Begin(); if (WhichVersionToInstall.Items.Count == 0) { WhichVersionToInstall.Visibility = Visibility.Hidden; } else { if (WhichVersionToInstall.SelectedIndex == -1) { WhichVersionToInstall.SelectedIndex = 0; } } }; Installer.Finished += (src, evnt) => Invoke(() => { if((CoApp.Toolkit.Configuration.RegistryView.CoAppUser["Preferences", "Autoclose"].BoolValue)) { ActuallyClose(); } else { WaitForClose(); } }); }
public InstallerMainWindow(Installer installer) { Opacity = 0; Installer = installer; InitializeComponent(); OrganizationName.SetBinding(TextBlock.TextProperty, new Binding("Organization") {Source = Installer}); ProductName.SetBinding(TextBlock.TextProperty, new Binding("Product") {Source = Installer}); // package icon disabled until after RC // PackageIcon.SetBinding(Image.SourceProperty, new Binding("PackageIcon") { Source = Installer }); DescriptionText.SetBinding(TextBlock.TextProperty, new Binding("Description") {Source = Installer}); WhichVersionToInstall.SetBinding(ItemsControl.ItemsSourceProperty, new Binding("InstallChoices") {Source = Installer}); WhichVersionToInstall.DisplayMemberPath = "Value"; WhichVersionToInstall.SelectedValuePath = "Key"; WhichVersionToInstall.SetBinding(Selector.SelectedValueProperty, new Binding("Choice") {Source = Installer}); WhichVersionToInstall.SelectedIndex = 0; ProductVersion.SetBinding(TextBlock.TextProperty, new Binding("ProductVersion") {Source = Installer}); InstallButton.SetBinding(IsEnabledProperty, new Binding("ReadyToInstall") {Source = Installer}); InstallButton.SetBinding(ToolTipProperty, new Binding("InstallButtonText") {Source = Installer}); InstallText.SetBinding(TextBlock.TextProperty, new Binding("InstallButtonText") {Source = Installer}); RemoveButton.SetBinding(VisibilityProperty, new Binding("RemoveButtonVisibility") {Source = Installer}); RemoveAdvanced.SetBinding(VisibilityProperty, new Binding("RemoveButtonVisibility") {Source = Installer}); InstallationProgress.SetBinding(RangeBase.ValueProperty, new Binding("Progress") {Source = Installer}); CancelButton.SetBinding(VisibilityProperty, new Binding("CancelButtonVisibility") {Source = Installer}); RemoveContextMenu.SetBinding(ItemsControl.ItemsSourceProperty, new Binding("RemoveChoices") {Source = Installer}); try { VisibilityAnimation.SetAnimationType(RemoveButton, VisibilityAnimation.AnimationType.Fade); VisibilityAnimation.SetAnimationType(InstallButton, VisibilityAnimation.AnimationType.Fade); VisibilityAnimation.SetAnimationType(InstallationProgress, VisibilityAnimation.AnimationType.Fade); VisibilityAnimation.SetAnimationType(WhichVersionToInstall, VisibilityAnimation.AnimationType.Fade); VisibilityAnimation.SetAnimationType(CancelButton, VisibilityAnimation.AnimationType.Fade); } catch { } Loaded += (src, evnt) => { Topmost = false; if (Opacity <= 0 && Installer.HasPackage) { Installer.Ping = true; ShowInTaskbar = true; ((Storyboard)FindResource("showWindow")).Begin(); if (WhichVersionToInstall.SelectedIndex == -1) { WhichVersionToInstall.SelectedIndex = 0; } } }; Installer.Ready += (src, evnt) => Invoke(() => { if (!(Opacity > 0)) { Installer.Ping = true; ShowInTaskbar = true; ((Storyboard)FindResource("showWindow")).Begin(); if (WhichVersionToInstall.SelectedIndex == -1) { WhichVersionToInstall.SelectedIndex = 0; } } }); Installer.Finished += (src, evnt) => Invoke(() => { ((Storyboard)FindResource("hideWindow")).Completed += (ss, ee) => Invoke(Close); ((Storyboard)FindResource("hideWindow")).Begin(); }); }