コード例 #1
0
        public async Task AddHost(HostInstall host)
        {
            host.AddLocales(locales);
            Hosts.Add(host);
            await host.AddStreams(Streams.Values);

            await host.AddBranches(branches);

            host.CheckRegistryForHostInstall();
        }
コード例 #2
0
ファイル: HostTile.xaml.cs プロジェクト: JPPGroup/Installer
        public HostTile(HostInstall model)
        {
            InitializeComponent();
            _model           = model;
            this.DataContext = model;

            try
            {
                BitmapImage source = new BitmapImage();
                source.BeginInit();
                source.UriSource = new Uri($"pack://application:,,,/Assets/{model.Name}.jpg", UriKind.Absolute);
                source.EndInit();

                if (!model.HostInstalled)
                {
                    FormatConvertedBitmap newFormatedBitmapSource = new FormatConvertedBitmap();
                    newFormatedBitmapSource.BeginInit();
                    newFormatedBitmapSource.Source            = source;
                    newFormatedBitmapSource.DestinationFormat = PixelFormats.Gray32Float;
                    newFormatedBitmapSource.EndInit();

                    Banner.Source = newFormatedBitmapSource;
                }
                else
                {
                    Banner.Source = source;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            this._model.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == nameof(HostInstall.Active) && _model.Active != null)
                {
                    Xceed.Wpf.Toolkit.MessageBox.Show("Application installed", "", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            };
        }