Bitmap GetIcon(WindowIcon icon)
 {
     using var stream = new MemoryStream();
     icon.Save(stream);
     stream.Seek(0, SeekOrigin.Begin);
     return(new Bitmap(stream));
 }
Exemple #2
0
        /// <summary>
        /// Molto incasinato, in poche parole mi permette di interagire con la GUI dal codice
        /// Inoltre cambio icona all'app
        /// </summary>
        private void InitializeComponent()
        {
            AvaloniaXamlLoader.Load(this);


            tab         = this.FindControl <TabControl>("tabControl1");
            nome        = this.FindControl <TextBox>("NameTxt");
            token       = this.FindControl <TextBox>("TokenTxt");
            status      = this.FindControl <TextBlock>("StatusTextBlock");
            configBtn   = this.FindControl <Button>("ConfigBtn");
            download    = this.FindControl <Button>("DownloadBtn");
            bar         = this.FindControl <ProgressBar>("DownloadPB");
            modpackCBox = this.FindControl <ComboBox>("ModpackCBox");
            modpackCBox.SelectionChanged += ModpackCBox_SelectionChanged;
            modList         = this.FindControl <TextBox>("Modlist");
            link            = this.FindControl <TextBlock>("LinkTextBlock");
            link.Foreground = Brushes.Blue;
            link.Tapped    += Link_Tapped;
            image           = this.FindControl <Avalonia.Controls.Image>("ModpackIcon");
            image.Tapped   += Image_Tapped;
            ForgeU          = this.FindControl <TextBox>("ForgeTxtU");
            ModU            = this.FindControl <TextBox>("ModsTxtU");
            NomeU           = this.FindControl <TextBox>("NameTxtU");
            DropboxU        = this.FindControl <TextBox>("TokenTxtU");
            SelectForge     = this.FindControl <Button>("ForgeBtn");
            SelectMods      = this.FindControl <Button>("ModsBtn");
            Upload          = this.FindControl <Button>("UploadBtn");
            UploadPB        = this.FindControl <ProgressBar>("UploadPB");
            statusU         = this.FindControl <TextBlock>("StatusTextBlockU");
            var        assets = AvaloniaLocator.Current.GetService <IAssetLoader>();
            Bitmap     bitmap = new Bitmap(assets.Open(new Uri("resm:ModpackUpdater4.AppIcon.png")));
            WindowIcon icon   = new WindowIcon(bitmap);

            this.Icon = icon;
        }
Exemple #3
0
        protected override void Icon_Click(object sender, RoutedEventArgs e)
        {
            base.Icon_Click(sender, e);

            WindowIcon icon = sender as WindowIcon;

            if (icon == null)
            {
                return;
            }

            FloatingWindow w = icon.Window;

            if (w == null)
            {
                return;
            }

            FrameworkElement host = w.HostPanel;

            if (host == null)
            {
                return;
            }

            ZoomAndPanControl zoomHost = host.Parent as ZoomAndPanControl;

            if (zoomHost == null)
            {
                return;
            }

            zoomHost.ScrollToCenter(w.BoundingRectangle); //zoomHost.ZoomTo(w.BoundingRectangle);
        }
Exemple #4
0
 public MainWindow()
 {
     InitializeComponent();
     Icon = new WindowIcon(System.Reflection.Assembly.GetExecutingAssembly()
                           .GetManifestResourceStream("CSharpMath.Avalonia.Example.Icon.png"));
     this.AttachDevTools();
 }
    public ApplicationViewModel(IMainWindowService mainWindowService)
    {
        _mainWindowService = mainWindowService;

        QuitCommand = ReactiveCommand.Create(ShutDown);

        ShowHideCommand = ReactiveCommand.Create(() =>
        {
            if (IsMainWindowShown)
            {
                _mainWindowService.Hide();
            }
            else
            {
                _mainWindowService.Show();
            }
        });

        ShowCommand = ReactiveCommand.Create(() => _mainWindowService.Show());

        AboutCommand = ReactiveCommand.Create(
            () => MainViewModel.Instance.DialogScreen.To(new AboutViewModel(navigateBack: MainViewModel.Instance.DialogScreen.CurrentPage is not null)),
            canExecute: MainViewModel.Instance.DialogScreen.WhenAnyValue(x => x.CurrentPage).Select(x => x is null));

        using var bitmap = AssetHelpers.GetBitmapAsset("avares://WalletWasabi.Fluent/Assets/WasabiLogo.ico");
        TrayIcon         = new WindowIcon(bitmap);
    }
            public static void Draw(string title, string subtitle, GUIStyle icon, ColorName colorName)
            {
                Color initialColor = GUI.color;

                float height = WindowIcon.Height;

                GUILayout.BeginVertical();
                {
                    GUI.color = Colors.GetDColor(colorName).Dark.WithAlpha(GUI.color.a * 0.1f);
                    GUILayout.Label(GUIContent.none, Styles.GetStyle(Styles.StyleName.WhiteGradientTopToBottom), GUILayout.ExpandWidth(true), GUILayout.Height(height));
                    GUILayout.Space(-height);
                    GUI.color = initialColor;
                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Space(Properties.Space(4));
                        Icon.Draw(icon, height * 0.8f, height, colorName);
                        GUILayout.Space(Properties.Space(4));
                        GUILayout.BeginVertical(GUILayout.Height(height));
                        {
                            GUILayout.FlexibleSpace();
                            Label.Draw(title.ToUpper(), TitleStyle, colorName);
                            Label.Draw(subtitle, SubtitleStyle, colorName);
                            GUILayout.Space(Properties.Space());
                            GUILayout.FlexibleSpace();
                        }
                        GUILayout.EndVertical();
                        GUILayout.FlexibleSpace();
                        WindowIcon.Draw(icon, colorName);
                    }
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndVertical();

                GUI.color = initialColor;
            }
 /// <summary>
 /// Gets the application icon.
 /// </summary>
 /// <returns>WindowIcon.</returns>
 public static WindowIcon GetAppIcon()
 {
     if (windowIcon == null)
     {
         using var ms = GetAppIconStream();
         windowIcon   = new WindowIcon(ms);
     }
     return(windowIcon);
 }
        public StyleableWindow()
        {
            WindowStartupLocation = WindowStartupLocation.CenterOwner;
            TransparencyLevelHint = WindowTransparencyLevel.None;

            using Stream stream = Assembly.GetAssembly(typeof(Ryujinx.Ui.Common.Configuration.ConfigurationState)).GetManifestResourceStream("Ryujinx.Ui.Common.Resources.Logo_Ryujinx.png");

            Icon            = new WindowIcon(stream);
            stream.Position = 0;
            IconImage       = new Bitmap(stream);
        }
Exemple #9
0
        public void ApplyBranding()
        {
            try
            {
                var brandingInfo = DeviceInitService?.BrandingInfo ?? new Shared.Models.BrandingInfo();

                ProductName = "Remotely";

                if (!string.IsNullOrWhiteSpace(brandingInfo?.Product))
                {
                    ProductName = brandingInfo.Product;
                }

                TitleBackgroundColor = new SolidColorBrush(Color.FromRgb(
                    brandingInfo?.TitleBackgroundRed ?? 70,
                    brandingInfo?.TitleBackgroundGreen ?? 70,
                    brandingInfo?.TitleBackgroundBlue ?? 70));

                TitleForegroundColor = new SolidColorBrush(Color.FromRgb(
                   brandingInfo?.TitleForegroundRed ?? 29,
                   brandingInfo?.TitleForegroundGreen ?? 144,
                   brandingInfo?.TitleForegroundBlue ?? 241));

                TitleButtonForegroundColor = new SolidColorBrush(Color.FromRgb(
                   brandingInfo?.ButtonForegroundRed ?? 255,
                   brandingInfo?.ButtonForegroundGreen ?? 255,
                   brandingInfo?.ButtonForegroundBlue ?? 255));

                if (brandingInfo?.Icon?.Any() == true)
                {
                    using var imageStream = new MemoryStream(brandingInfo.Icon);
                    Icon = new Bitmap(imageStream);
                }
                else
                {
                    using var imageStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Remotely.Desktop.XPlat.Assets.Remotely_Icon.png");
                    Icon = new Bitmap(imageStream);
                }

                WindowIcon = new WindowIcon(Icon);

                this.RaisePropertyChanged(nameof(ProductName));
                this.RaisePropertyChanged(nameof(TitleBackgroundColor));
                this.RaisePropertyChanged(nameof(TitleForegroundColor));
                this.RaisePropertyChanged(nameof(TitleButtonForegroundColor));
                this.RaisePropertyChanged(nameof(WindowIcon));
            }
            catch (Exception ex)
            {
                Logger.Write(ex, "Error applying branding.");
            }
        }
 private void SetGUI()
 {
     Icon  = new WindowIcon((Bitmap)BitmapValueConverter.Instance.Convert((object)"resm:PKCS11Explorer.Assets.baseline_sim_card_black_18dp.png", typeof(IBitmap), null, null));
     Title = "PKCS11 Explorer";
     Console.WriteLine("PKCS11 Explorer version " + ((App)App.Current).Version);
     Console.WriteLine("");
     Console.WriteLine("Debug console");
     Console.WriteLine("---------------------");
     MyTreeView.Width     = Double.NaN;
     MyTreeView.Height    = Double.NaN;
     MyTreeView.IsVisible = false;
     PKCS11Lister.ListForTreeviewFinished += OnListForTreeviewFinished;
 }
        private void SetUI(string title, string description, string imageURI)
        {
            TextBlock text   = this.FindControl <TextBlock>("Text");
            Image     image  = this.FindControl <Image>("Image");
            Button    button = this.FindControl <Button>("Button");

            this.Title    = title;
            text.Text     = description;
            image.Source  = (Bitmap)BitmapValueConverter.Instance.Convert((object)imageURI, typeof(IBitmap), null, null);
            SizeToContent = SizeToContent.WidthAndHeight;
            Icon          = new WindowIcon((Bitmap)BitmapValueConverter.Instance.Convert((object)imageURI, typeof(IBitmap), null, null));
            CanResize     = false;
        }
Exemple #12
0
        private void BuildWindow()
        {
            Icon = new WindowIcon(BuildAppIcon());

            Width    = WIDTH;
            MinWidth = WIDTH;
            MaxWidth = WIDTH;

            Height    = HEIGHT;
            MinHeight = HEIGHT;
            MaxHeight = HEIGHT;

            CanResize = false;
        }
Exemple #13
0
 /// <inheritdoc/>
 public UIFactory(WindowIcon applicationIcon, string releaseNotesSeparatorTemplate = "", string releaseNotesHeadAddition = "") : this()
 {
     _applicationIcon = applicationIcon;
     if (applicationIcon != null)
     {
         using (var stream = new MemoryStream())
         {
             applicationIcon?.Save(stream);
             stream.Position = 0;
             _iconBitmap     = new Bitmap(stream);
         }
     }
     ReleaseNotesHTMLTemplate         = releaseNotesSeparatorTemplate;
     AdditionalReleaseNotesHeaderHTML = releaseNotesHeadAddition;
 }
Exemple #14
0
        protected override void OnTemplateApplied(TemplateAppliedEventArgs e)
        {
            base.OnTemplateApplied(e);

            SetupWindowEdge(e, "PART_RightGrip", StandardCursorType.RightSide, WindowEdge.East);
            SetupWindowEdge(e, "PART_LeftGrip", StandardCursorType.LeftSide, WindowEdge.West);
            SetupWindowEdge(e, "PART_TopGrip", StandardCursorType.TopSide, WindowEdge.North);
            SetupWindowEdge(e, "PART_BottomGrip", StandardCursorType.BottomSide, WindowEdge.South);
            SetupWindowEdge(e, "PART_TopLeftGrip", StandardCursorType.TopLeftCorner, WindowEdge.NorthWest);
            SetupWindowEdge(e, "PART_TopRightGrip", StandardCursorType.TopRightCorner, WindowEdge.NorthEast);
            SetupWindowEdge(e, "PART_BottomLeftGrip", StandardCursorType.BottomLeftCorner, WindowEdge.SouthWest);
            SetupWindowEdge(e, "PART_BottomRightGrip", StandardCursorType.BottomRightCorner, WindowEdge.SouthEast);

            GetControl <Border>(e, "PART_TitleBar").PointerPressed += (sender, args) => PlatformImpl?.BeginMoveDrag(args);

            _closeButton        = GetControl <Button>(e, "PART_Close");
            _closeButton.Click += (object sender, RoutedEventArgs arg) => Close();

            var isNotModal = !IsModal;

            _minimizeButton           = GetControl <Button>(e, "PART_Minimize");
            _minimizeButton.IsVisible = isNotModal;
            _minimizeButton.Click    += delegate { WindowState = WindowState.Minimized; };

            _maximizeButton           = GetControl <Button>(e, "PART_Maximize");
            _maximizeButton.IsVisible = isNotModal;
            _maximizeButton.Click    += delegate { WindowState = WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized; };

            _icon = GetControl <Image>(e, "PART_Icon");
            if (Icon == null)
            {
                var uri    = new Uri(DEFAULT_ICON, UriKind.Absolute);
                var assets = AvaloniaLocator.Current.GetService <IAssetLoader>();
                using (var stream = assets.Open(uri))
                {
                    stream.Seek(0, SeekOrigin.Begin);
                    _icon.Source = new Bitmap(stream);
                }

                Icon = new WindowIcon(_icon.Source);
            }
            else
            {
                _icon.Source = GetIcon(Icon);
            }

            _isTemplateApplied = true;
        }
        public ModalDialogViewModelBase(string title, bool okayButton = true, bool cancelButton = true, string iconUri = null)
        {
            OKButtonVisible     = okayButton;
            CancelButtonVisible = cancelButton;

            isVisible  = false;
            this.title = title;

            CancelCommand = ReactiveCommand.Create(() => Close(false));

            if (!string.IsNullOrEmpty(iconUri))
            {
                var loader     = AvaloniaLocator.Current.GetService <IAssetLoader>();
                var iconStream = loader.Open(new Uri(iconUri));
                this.icon = new WindowIcon(iconStream);
            }
        }
Exemple #16
0
    // Load here instead of in xaml for better control
    private void InitializeComponent()
    {
        Title = Project.ProjectSettings.Name ?? "<Name>";

        Background = Theme.TabBackground;

        MinWidth  = MinWindowSize;
        MinHeight = MinWindowSize;

        Icon = new WindowIcon(Icons.Streams.Logo);

        Content = TabViewer = new TabViewer(Project);

        PositionChanged += BaseWindow_PositionChanged;

        this.GetObservable(ClientSizeProperty).Subscribe(Resize);
    }
        public MainWindow()
        {
            InitializeComponent();

            Title += " v" + DragonVersion.VERSION;

            if (File.Exists("rw-logo_250.ico"))
            {
                Bitmap b = new Bitmap("rw-logo_250.ico");
                Icon = new WindowIcon(b);
            }

            Closing += OnClosing;

            Settings set = SettingsManager.LoadSettings();

            TxtPassword       = this.FindControl <TextBox>("txtPassword");
            BtnDownloadUpdate = this.FindControl <Button>("btnDownloadUpdate");


            DataContext = new MainWindowViewModel
            {
                ThisWindow            = this,
                TxtPassword           = TxtPassword,
                Status                = "Open a markdown file to start!",
                AllowInput            = true,
                RememberCredentials   = set.ShouldLoadCredentials,
                Username              = set.Username,
                Password              = set.Password,
                FirstImageRight       = true,
                Settings              = set,
                SaveConverterSettings = set.RememberConverterSettings
            };

            if (set.RememberConverterSettings)
            {
                ((MainWindowViewModel)DataContext).SaveOutputToHtml  = set.OutputToHtml;
                ((MainWindowViewModel)DataContext).SaveOutputToPdf   = set.OutputToPdf;
                ((MainWindowViewModel)DataContext).FirstImageRight   = set.ConverterOptions.FirstImageIsAlignedRight;
                ((MainWindowViewModel)DataContext).ReplaceImageAlts  = set.ConverterOptions.ReplaceImageWithAltWithCaption;
                ((MainWindowViewModel)DataContext).UseContentScanner = set.UseContentScanner;
            }

            CheckForUpdate();
        }
Exemple #18
0
        //private static bool _rsz = true;
        public static unsafe void Load()
        {
            using var image = Image.Load <Rgba32>("favicon.png");
            Span <byte> span;

            byte[] arr;
            var    ogspan = image.GetPixelSpan();

            fixed(Rgba32 *pixels = ogspan)
            {
                span = new Span <byte>(pixels, ogspan.Length * 4);
                arr  = span.ToArray();
            }

            var icon = new WindowIcon(image.Width, image.Height, arr);

            window.SetWindowIcon(ref icon);
            Console.WriteLine("Finished loading");
        }
Exemple #19
0
        protected override void OnLoad()
        {
            Console.Write("Loading...");

            base.OnLoad();

            KeyInput.SetWindow(this);
            MouseInput.SetWindow(this);

            // Load icon
            var iconData = BitmapLoader.LoadBytes(FileExplorer.FindIn(FileExplorer.Misc, "warsnu"), out var iconWidth, out var iconHeight);

            Icon = new WindowIcon(new Image(iconWidth, iconHeight, iconData));

            MasterRenderer.Initialize();
            SheetManager.InitSheets();

            timer.Restart();
            FontManager.Load();
            timer.StopAndWrite("Loading Fonts");

            timer.Restart();
            AudioController.Load();
            MusicController.Load();
            timer.StopAndWrite("Loading Sound");

            timer.Restart();
            GameController.Load();
            timer.StopAndWrite("Loading Rules");

            SheetManager.FinishSheets();
            MasterRenderer.InitRenderer();

            GameController.CreateFirst();

            Ready = true;
            Console.WriteLine(" Done!");

            if (Program.OnlyLoad)
            {
                Program.Exit();
            }
        }
Exemple #20
0
        public BrandedViewModelBase()
        {
            var deviceInit = ServiceContainer.Instance?.GetRequiredService <IDeviceInitService>();

            var brandingInfo = deviceInit?.BrandingInfo ?? new Shared.Models.BrandingInfo();

            ProductName = "Remotely";

            if (!string.IsNullOrWhiteSpace(brandingInfo?.Product))
            {
                ProductName = brandingInfo.Product;
            }

            TitleBackgroundColor = new SolidColorBrush(Color.FromRgb(
                                                           brandingInfo?.TitleBackgroundRed ?? 70,
                                                           brandingInfo?.TitleBackgroundGreen ?? 70,
                                                           brandingInfo?.TitleBackgroundBlue ?? 70));

            TitleForegroundColor = new SolidColorBrush(Color.FromRgb(
                                                           brandingInfo?.TitleForegroundRed ?? 29,
                                                           brandingInfo?.TitleForegroundGreen ?? 144,
                                                           brandingInfo?.TitleForegroundBlue ?? 241));

            TitleButtonForegroundColor = new SolidColorBrush(Color.FromRgb(
                                                                 brandingInfo?.ButtonForegroundRed ?? 255,
                                                                 brandingInfo?.ButtonForegroundGreen ?? 255,
                                                                 brandingInfo?.ButtonForegroundBlue ?? 255));

            if (brandingInfo?.Icon?.Any() == true)
            {
                using var imageStream = new MemoryStream(brandingInfo.Icon);
                Icon = new Bitmap(imageStream);
            }
            else
            {
                using var imageStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Remotely.Desktop.Linux.Assets.Remotely_Icon.png");
                Icon = new Bitmap(imageStream);
            }

            WindowIcon = new WindowIcon(Icon);
        }
Exemple #21
0
 public static IBitmap ToBitmap(this WindowIcon icon)
 {
     if (icon != null)
     {
         MemoryStream stream = new MemoryStream();
         icon.Save(stream);
         stream.Position = 0;
         try
         {
             return(new Bitmap(stream));
         }
         catch
         {
             return(null);
         }
     }
     else
     {
         return(null);
     }
 }
Exemple #22
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value != null)
     {
         WindowIcon   wIcon  = value as WindowIcon;
         MemoryStream stream = new MemoryStream();
         wIcon.Save(stream);
         stream.Position = 0;
         try
         {
             return(new Bitmap(stream));
         }
         catch
         {
             return(null);
         }
     }
     else
     {
         return(null);
     }
 }
Exemple #23
0
 /// <summary>
 /// Sets a single window icon on the given window.
 /// </summary>
 /// <param name="window">The window.</param>
 /// <param name="icon">The icon to set.</param>
 public static void SetWindowIcon(this IWindow window, ref WindowIcon icon) => window.SetWindowIcon
     (new[] { icon });
Exemple #24
0
 private void WindowIcon_MouseDown(object sender, RoutedEventArgs e)
 {
     SystemCommands.ShowSystemMenu(this, WindowIcon.PointToScreen(new System.Windows.Point(0, WindowIcon.ActualHeight)));
 }
Exemple #25
0
        void InitializeComponent()
        {
            Title  = $"AutoMasshTik {NiceVersion}";
            Height = MinHeight = 300;
            Width  = MinWidth = 830;
            using (Stream stream = typeof(MainWindow).Assembly.GetManifestResourceStream("AutoMasshTik.UI.Assets.automasshtik.ico"))
            {
                Icon = new WindowIcon(stream);
            }
            SolidColorBrush defaultBorderBrush     = new SolidColorBrush(Colors.Black, opacity: .4);
            var             defaultBorderThickness = new Thickness(.5);

            Styles.Add(
                new Style(s => s.OfType <TextBox>().Class("input"))
                .AddSetters(
                    new Setter(TextBox.BorderThicknessProperty, defaultBorderThickness),
                    new Setter(TextBox.BorderBrushProperty, defaultBorderBrush),
                    new Setter(TextBox.UseFloatingWatermarkProperty, true)
                    ));
            Content = new Grid
            {
                RowDefinitions    = new RowDefinitions("Auto, *, Auto, Auto"),
                ColumnDefinitions = new ColumnDefinitions("200,5,300,5,*"),
                Margin            = new Thickness(10)
            }
            .AddChildren(
                new TextBox
            {
                [!TextBox.TextProperty] = new Binding(nameof(ViewModel.ServersText), BindingMode.TwoWay),
                AcceptsReturn           = true,
                Watermark = "Addresses",
                [!Button.IsEnabledProperty] = new Binding(nameof(ViewModel.IsUpdating))
                {
                    Converter = NegateConverter.Default
                }
            }.AddClass("input").SetGridRowSpan(3),
                new StackPanel
            {
            }.SetGridColumn(2)
                .AddChildren(
                    new TextBox
            {
                Watermark = "Username",
                [!TextBox.TextProperty]        = new Binding(nameof(ViewModel.Username), BindingMode.TwoWay),
                [!TextBox.BorderBrushProperty] = new Binding(nameof(ViewModel.Username))
                {
                    Converter = NotEmptyRequiredToBrushConverter.Default
                },
                [!TextBlock.IsEnabledProperty] = new Binding(nameof(ViewModel.IsUpdating))
                {
                    Converter = NegateConverter.Default
                }
            }.AddClass("input"),
                    new Grid
            {
                ColumnDefinitions   = new ColumnDefinitions("*, Auto"),
                HorizontalAlignment = HorizontalAlignment.Stretch,
            }
                    .AddChildren(
                        new TextBox
            {
                Watermark = "Password",
                [!TextBox.TextProperty]        = new Binding(nameof(ViewModel.Password), BindingMode.TwoWay),
                [!TextBox.BorderBrushProperty] = new Binding(nameof(ViewModel.Password))
                {
                    Converter = NotEmptyRequiredToBrushConverter.Default
                },
                Margin = new Thickness(0, 5, 0, 0),
                [!TextBox.PasswordCharProperty] = new Binding(nameof(ViewModel.ShowPassword))
                {
                    Converter = ShowPasswordToCharConverter.Default
                },
                [!TextBlock.IsEnabledProperty] = new Binding(nameof(ViewModel.IsUpdating))
                {
                    Converter = NegateConverter.Default
                }
            }.AddClass("input"),
                        new Button
            {
                [!Button.ContentProperty] = new Binding(nameof(ViewModel.ShowPassword))
                {
                    Converter = ShowPasswordToToggleButtonCaptionConverter.Default
                },
                Margin   = new Thickness(2, 5, 0, 0),
                MinWidth = 50,
                [!Button.CommandProperty] = new Binding(nameof(ViewModel.ToggleShowPasswordCommand))
            }.SetGridColumn(1)
                        ),
                    new TextBox
            {
                Watermark = "Port",
                [!TextBox.TextProperty] = new Binding(nameof(ViewModel.Port), BindingMode.TwoWay)
                {
                    Converter = IntToStringConverter.Default
                },
                Margin = new Thickness(0, 5, 0, 0),
                Width  = 40,
                HorizontalAlignment            = HorizontalAlignment.Left,
                [!TextBlock.IsEnabledProperty] = new Binding(nameof(ViewModel.IsUpdating))
                {
                    Converter = NegateConverter.Default
                }
            }.AddClass("input")
                    ),
                new StackPanel
            {
                VerticalAlignment = VerticalAlignment.Center,
                Orientation       = Orientation.Vertical,
                [!StackPanel.IsVisibleProperty] = new Binding(nameof(ViewModel.IsUpdating), BindingMode.OneWay)
            }.SetGridColumn(2).SetGridRow(1)
                .AddChildren(
                    new TextBlock
            {
                [!TextBlock.TextProperty] = new Binding(nameof(ViewModel.OperationInProgress)),
                HorizontalAlignment       = HorizontalAlignment.Center
            },
                    new ProgressBar
            {
                [!ProgressBar.ValueProperty] = new Binding(nameof(ViewModel.ServerModels), BindingMode.OneWay)
                {
                    Converter = ServersToProgressConverter.Default
                },
                [!ProgressBar.MaximumProperty] = new Binding(nameof(ViewModel.ServerModels), BindingMode.OneWay)
                {
                    Converter = ServersToProgressMaxConverter.Default
                }
            }),
                new StackPanel
            {
                Orientation = Orientation.Vertical,
            }.SetGridColumn(2).SetGridRow(2)
                .AddChildren(
                    new Button
            {
                Content = "Test connection",
                [!Button.IsVisibleProperty] = new Binding(nameof(ViewModel.IsUpdating))
                {
                    Converter = NegateConverter.Default
                },
                [!Button.CommandProperty] = new Binding(nameof(ViewModel.StartUpdateCommand)),
                CommandParameter          = UpdateMode.Connection
            },
                    new Button
            {
                Content = "Update Packages",
                Margin  = new Thickness(0, 5, 0, 0),
                [!Button.IsVisibleProperty] = new Binding(nameof(ViewModel.IsUpdating))
                {
                    Converter = NegateConverter.Default
                },
                [!Button.CommandProperty] = new Binding(nameof(ViewModel.StartUpdateCommand)),
                CommandParameter          = UpdateMode.Packages
            },
                    new Button
            {
                Content = "Update Firmware And Reboot",
                Margin  = new Thickness(0, 5, 0, 0),
                [!Button.IsVisibleProperty] = new Binding(nameof(ViewModel.IsUpdating))
                {
                    Converter = NegateConverter.Default
                },
                [!Button.CommandProperty] = new Binding(nameof(ViewModel.StartUpdateCommand)),
                CommandParameter          = UpdateMode.Firmware
            },
                    new Button
            {
                Content = "Cancel",
                [!Button.IsVisibleProperty] = new Binding(nameof(ViewModel.IsUpdating)),
                [!Button.CommandProperty]   = new Binding(nameof(ViewModel.StopUpdateCommand))
            }),
                new ListBox
            {
                BorderThickness          = new Thickness(.8),
                BorderBrush              = defaultBorderBrush,
                [!ListBox.ItemsProperty] = new Binding(nameof(ViewModel.Servers)),
                ItemTemplate             = CreateServerTemplate(),
            }.SetGridRowSpan(3).SetGridColumn(4),
                new TextBlock
            {
                Text = "New version available, restart to update",
                HorizontalAlignment            = HorizontalAlignment.Center,
                [!TextBlock.IsVisibleProperty] = new Binding(nameof(ViewModel.NewVersionAvailable))
            }.SetGridRow(3).SetGridColumn(2),
                new TextBlock
            {
                Text = "Made by Righthand & WLAN novagorica.eu",
                HorizontalAlignment = HorizontalAlignment.Right,
            }.SetGridRow(3).SetGridColumn(4)
                );
        }
        public async Task <bool> ShowNotification(string message, string title  = null, string header = null, Window parentWindow = null,
                                                  MessageBoxType messageBoxType = MessageBoxType.Ok, bool showInCenter = true,
                                                  WindowStartupLocation windowStartupLocation = WindowStartupLocation.CenterOwner,
                                                  Style style = Style.UbuntuLinux, Icon icon = Icon.Info, WindowIcon windowIcon = null, bool canResize = false)
        {
            var msgBox = new MessageBoxCustomParams
            {
                Icon  = icon,
                Style = style,
                WindowStartupLocation = windowStartupLocation,
                ShowInCenter          = showInCenter,
                ContentTitle          = title ?? Properties.Resources.notification,
                ContentHeader         = header,
                CanResize             = canResize,
                ContentMessage        = message,
            };

            switch (messageBoxType)
            {
            case MessageBoxType.Generate_Cancel:
                msgBox.ButtonDefinitions = new[] { new ButtonDefinition {
                                                       Name = Properties.Resources.generateReport
                                                   }, new ButtonDefinition {
                                                       Name = Properties.Resources.cancel, Type = ButtonType.Colored
                                                   } };
                break;

            case MessageBoxType.Yes_No:
                msgBox.ButtonDefinitions = new[] { new ButtonDefinition {
                                                       Name = Properties.Resources.yes
                                                   }, new ButtonDefinition {
                                                       Name = Properties.Resources.no, Type = ButtonType.Colored
                                                   } };
                break;

            default:
                msgBox.ButtonDefinitions = new[] { new ButtonDefinition {
                                                       Name = Properties.Resources.ok
                                                   } };
                break;
            }

            //The feature is temporarily unavailable
            //if (windowIcon == null)
            //{
            //    var assets = AvaloniaLocator.Current.GetService<IAssetLoader>();
            //    msgBox.WindowIcon = new WindowIcon(assets.Open(new Uri("avares://PertEstimationTool/Assets/main.ico")));
            //}

            var result = await MessageBox.Avalonia.MessageBoxManager.GetMessageBoxCustomWindow(msgBox).ShowDialog(parentWindow);

            if (result == Properties.Resources.yes || result == Properties.Resources.generateReport)
            {
                return(true);
            }

            return(false);
        }