public static void RegisterDependency(ContainerBuilder builder) { builder.RegisterAssemblyTypes(typeof(DependencyInjectionConfiguration).Assembly); var window = System.Windows.Application.Current.MainWindow; var application = new WpfApplication(window); builder.RegisterInstance(application).As <IApplication>(); builder.RegisterInstance(new WPFUIDispatcher(window.Dispatcher)).As <IDispatcher>(); builder.RegisterType <ApplicationLifeCycle>().As <IApplicationLifeCycle>(); builder.RegisterType <Adaptive.ReactiveTrader.Client.Domain.ReactiveTrader>().As <IReactiveTrader>().SingleInstance(); builder.RegisterType <DebugLoggerFactory>().As <ILoggerFactory>().SingleInstance(); builder.RegisterType <NullProcessorMonitor>().As <IProcessorMonitor>().SingleInstance(); builder.RegisterType <ConstantRatePump>().As <IConstantRatePump>(); builder.RegisterType <ShellViewModel>().As <IShellViewModel>().ExternallyOwned().SingleInstance(); builder.RegisterType <SpotTilesViewModel>().As <ISpotTilesViewModel>().ExternallyOwned(); builder.RegisterType <SpotTileViewModel>().As <ISpotTileViewModel>().ExternallyOwned(); builder.RegisterType <SpotTileErrorViewModel>().As <ISpotTileErrorViewModel>().ExternallyOwned(); builder.RegisterType <SpotTileConfigViewModel>().As <ISpotTileConfigViewModel>().ExternallyOwned(); builder.RegisterType <SpotTilePricingViewModel>().As <ISpotTilePricingViewModel>().ExternallyOwned(); builder.RegisterType <OneWayPriceViewModel>().As <IOneWayPriceViewModel>().ExternallyOwned(); builder.RegisterType <SpotTileAffirmationViewModel>().As <ISpotTileAffirmationViewModel>().ExternallyOwned(); builder.RegisterType <BlotterViewModel>().As <IBlotterViewModel>().ExternallyOwned(); builder.RegisterType <TradeViewModel>().As <ITradeViewModel>().ExternallyOwned(); builder.RegisterType <ConnectivityStatusViewModel>().As <IConnectivityStatusViewModel>().ExternallyOwned(); builder.RegisterType <ConfigurationProvider>().As <IConfigurationProvider>(); builder.RegisterType <ConstantRateConfigurationProvider>().As <IConstantRateConfigurationProvider>(); builder.RegisterType <UserProvider>().As <IUserProvider>(); builder.RegisterType <ConcurrencyService>().As <IConcurrencyService>(); }
public static void SafeShow(string text, string title = "", bool autoClose = true) { WpfApplication.SafeRun(() => { CreateWindow(text, title, false, autoClose).Show(); }); }
public TradeCalculatorPageViewModel(TradableGoodListViewModel tradeGoodList, IDataProvider dataProvider, WpfApplication application) { ResetAllCommand = new RelayCommand(ResetAll); mDataProvider = dataProvider; mApplication = application; TradeGoods = tradeGoodList; }
public PopulationCalculatorPageViewModel(IDataProvider repository, WpfApplication application) { Fractions = new List <FractionViewModel>(); Requirements = new ObservableCollection <BuildingViewModel>(); ResetAllCommand = new RelayCommand(ResetAll); mRepository = repository; mDispatcher = application.Dispatcher; }
public static void RegisterDependency(IKernel kernel) { var window = System.Windows.Application.Current.MainWindow; var application = new WpfApplication(window); kernel.Bind <IApplication>().ToConstant(application); kernel.Bind <IDispatcher>().ToConstant(new WPFUIDispatcher(window.Dispatcher)); kernel.Bind <IApplicationLifeCycle>().To <ApplicationLifeCycle>(); kernel.Bind <MainViewModel>().ToSelf().InSingletonScope(); }
public WindowsApplicationHost([NotNull] WpfApplication application) { if (application == null) { throw new ArgumentNullException(nameof(application)); } mApplication = application; mApplication.Host = this; }
private void OnAutoRun() { try { WpfApplication.AutoRun("DateWork.exe", _IsAutoRun); } catch (Exception ex) { MessageWindow.Show($"开机启动错误:{ex.Message}", "错误", false); } }
public static IWpfApplicationBuilder <TApplication, TWindow> CreateBuilder() { WpfApplicationOptions <TApplication, TWindow> options = new() { OnLoaded = (application, window, serviceProvider) => { var navigationService = (NavigationService)serviceProvider.GetRequiredService <INavigationService>(); navigationService.InitializeAsync(application, window).Wait(); } }; return(new KamishibaiApplicationBuilder <TApplication, TWindow>(WpfApplication <TApplication, TWindow> .CreateBuilder(options))); } }
/// <summary> /// RegisterSingleton application injection dependency. /// Should be used to add more binding between class to interface. /// </summary> /// <param name="kernel"> /// application Ninject kernel /// </param> private static void RegisterDependency(IKernel kernel) { var window = System.Windows.Application.Current.MainWindow; var application = new WpfApplication(window); kernel.Bind <IApplication>().ToConstant(application); kernel.Bind <IDispatcher>().ToConstant(new WPFUIDispatcher(window.Dispatcher)); kernel.Bind <IApplicationLifeCycle>().To <ApplicationLifeCycle>(); kernel.Bind <MainViewModel>().ToSelf().InSingletonScope(); kernel.Bind <PlayerViewModel>().ToSelf().InSingletonScope(); kernel.Bind <IPlayer>().To <Player>().InSingletonScope(); kernel.Bind <IIoReader>().To <IoReader>().InSingletonScope(); kernel.Bind <ITrackOrderLogicFactory>().To <TrackOrderLogicFactory>().InSingletonScope(); kernel.Bind <IRandomProvider>().To <RandomProvider>(); kernel.Bind <IMusicPlayer>().ToMethod(_ => BassMusicPlayer.Init(BassConfiguration.Email, BassConfiguration.Password)).InSingletonScope(); }
public ContextMenuActionsVM(WpfApplication application) { _application = application; ShowInstances = new DelegateCommand(_ => { var wnd = new View.InstancesList { DataContext = new { Items = _application.AllInstances } }; wnd.Show(); }); ShowMessages = new DelegateCommand(_ => { _application.ShowMessagesList(); }); ClearMessages = new DelegateCommand(_ => { _application.ClearMessagesList(); }); OpenSettings = new DelegateCommand(_ => { var wnd = new View.SettingsView { DataContext = new ViewModel.SettingsVM(_application) }; wnd.Show(); }); OpenAbout = new DelegateCommand(_ => { var wnd = new View.AboutView { Title = "About cgb_post_build_helper" }; wnd.Show(); }); ExitApplicationCommand = new DelegateCommand(_ => { _application.EndAllWatchesAndExitApplication(); }); }
public WatchedDirectoryVM(WpfApplication app, CgbAppInstanceVM inst, string directoryToWatch) { _app = app; _inst = inst; _dispatcher = System.Windows.Threading.Dispatcher.CurrentDispatcher; Directory = directoryToWatch; FileSystemWatcher = new FileSystemWatcher { Path = Directory, // Which kinds of changes to watch for (strangely enough, without Security, no change-events, WTF?!) NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.Attributes | NotifyFilters.CreationTime | NotifyFilters.Security | NotifyFilters.Size, // Files to be watched will be set later Filter = "TBD" }; Files = new ObservableCollection <WatchedFileVM>(); _inst.IssueAllOnPropertyChanged(); }
private void WpfLoop(TaskCompletionSource <AssemblyDocumentationCreator> creationTask, string resourceDictionaryUri) { try { var application = new WpfApplication(); _dispatcher = application.Dispatcher; var resourceDictionary = new ResourceDictionary { Source = new Uri(resourceDictionaryUri, UriKind.RelativeOrAbsolute) }; var creator = new AssemblyDocumentationCreator(_assembly, _dispatcher, resourceDictionary); creationTask.SetResult(creator); application.Run(); } catch (Exception e) { // Just in case we haven't set the result above, // we try to set the exception in case the ctor failed... creationTask.TrySetException(e); Log.ErrorFormat("Caught unexpected exception: {0}", e); } }
public WPF_DemosexeApplication(WpfApplication application) : base(application) { }
public MessagesListVM(WpfApplication app) { _app = app; }
static BindingTreeParserTests() { WpfApplication.Initialize(); }
public App(WpfApplication webAiiApp, Application whiteApp) { ApplicationWebAii = webAiiApp; ApplicationWhite = whiteApp; }
private void PictureBox_Click(object sender, EventArgs e) { System.Windows.Controls.Image currentImage = new Image(); System.Windows.Controls.Border currentBorder = new Border(); currentImage = (System.Windows.Controls.Image)sender; numSelectedCards++; var uriSource = new Uri(@"W:\Spring 2019\CGT 456\Assignments\MatchGameTemp\MatchGameTemp\bin\Debug\images\kitten.jpg", UriKind.Relative); int currentCard = 0; if (currentImage.Name == "pictureBox1") { currentCard = card1; currentBorder = pbBorder1; } else if (currentImage.Name == "pictureBox2") { currentCard = card2; currentBorder = pbBorder2; } else if (currentImage.Name == "pictureBox3") { currentCard = card3; currentBorder = pbBorder3; } else if (currentImage.Name == "pictureBox4") { currentCard = card4; currentBorder = pbBorder4; } else if (currentImage.Name == "pictureBox5") { currentCard = card5; currentBorder = pbBorder5; } else if (currentImage.Name == "pictureBox6") { currentCard = card6; currentBorder = pbBorder6; } else if (currentImage.Name == "pictureBox7") { currentCard = card7; currentBorder = pbBorder7; } else if (currentImage.Name == "pictureBox8") { currentCard = card8; currentBorder = pbBorder8; } else if (currentImage.Name == "pictureBox9") { currentCard = card9; currentBorder = pbBorder9; } else if (currentImage.Name == "pictureBox10") { currentCard = card10; currentBorder = pbBorder10; } else if (currentImage.Name == "pictureBox11") { currentCard = card11; currentBorder = pbBorder11; } else if (currentImage.Name == "pictureBox12") { currentCard = card12; currentBorder = pbBorder12; } if (currentCard == 1) { uriSource = new Uri(@"W:\Spring 2019\CGT 456\Assignments\MatchGameTemp\MatchGameTemp\bin\Debug\images\kitten.jpg", UriKind.Relative); } else if (currentCard == 2) { uriSource = new Uri(@"W:\Spring 2019\CGT 456\Assignments\MatchGameTemp\MatchGameTemp\bin\Debug\images\puppy.jpg", UriKind.Relative); } else if (currentCard == 3) { uriSource = new Uri(@"W:\Spring 2019\CGT 456\Assignments\MatchGameTemp\MatchGameTemp\bin\Debug\images\funnyMonkey.jpg", UriKind.Relative); } else if (currentCard == 4) { uriSource = new Uri(@"W:\Spring 2019\CGT 456\Assignments\MatchGameTemp\MatchGameTemp\bin\Debug\images\polarBears.jpg", UriKind.Relative); } else if (currentCard == 5) { uriSource = new Uri(@"W:\Spring 2019\CGT 456\Assignments\MatchGameTemp\MatchGameTemp\bin\Debug\images\WileECoyote.jpg", UriKind.Relative); } else if (currentCard == 6) { uriSource = new Uri(@"W:\Spring 2019\CGT 456\Assignments\MatchGameTemp\MatchGameTemp\bin\Debug\images\roadrunner.gif", UriKind.Relative); } currentImage.Source = new BitmapImage(uriSource); if (numSelectedCards == 2) { System.Threading.Thread.Sleep(100); WpfApplication.DoEvents(); System.Threading.Thread.Sleep(100); WpfApplication.DoEvents(); System.Threading.Thread.Sleep(1200); WpfApplication.DoEvents(); if (firstSelectedCard == currentCard) { currentBorder.Visibility = Visibility.Hidden; firstSelectedBorder.Visibility = Visibility.Hidden; totalNumMatchesRemoved++; displayMatches(); if (totalNumMatchesRemoved == 6) { lblCongrats.Visibility = Visibility.Visible; btnPlayAgain.Visibility = Visibility.Visible; } } else { mistakes++; lblMistakes.Content = mistakes.ToString(); uriSource = new Uri(@"W:\Spring 2019\CGT 456\Assignments\MatchGameTemp\MatchGameTemp\bin\Debug\images\cardBack.jpg", UriKind.Relative); pictureBox1.Source = new BitmapImage(uriSource); pictureBox2.Source = new BitmapImage(uriSource); pictureBox3.Source = new BitmapImage(uriSource); pictureBox4.Source = new BitmapImage(uriSource); pictureBox5.Source = new BitmapImage(uriSource); pictureBox6.Source = new BitmapImage(uriSource); pictureBox7.Source = new BitmapImage(uriSource); pictureBox8.Source = new BitmapImage(uriSource); pictureBox9.Source = new BitmapImage(uriSource); pictureBox10.Source = new BitmapImage(uriSource); pictureBox11.Source = new BitmapImage(uriSource); pictureBox12.Source = new BitmapImage(uriSource); } numSelectedCards = 0; firstSelectedCard = 0; firstSelectedBorder = new Border(); firstSelectedImage = new Image(); } else if (firstSelectedCard == 0) { firstSelectedCard = currentCard; firstSelectedImage = currentImage; firstSelectedBorder = currentBorder; } }
public Demo2exeApplication(WpfApplication application) : base(application) { }
public SettingsVM(WpfApplication application) { _application = application; }