Ejemplo n.º 1
0
 /// <summary>
 /// GTK-specific implementation.
 /// </summary>
 /// <param name="ready">If set to <c>true</c>, application is ready.</param>
 static partial void InitializeProgressIndicatorIfNecessary(bool ready)
 {
     if (ready && (SingleInstanceApplication.Current.MainWindow.GetValue(ProgressIndicatorViewModelDataContextProperty) == null))
     {
         // Lazy-initialize the progress indicator viewmodel.
         var progressIndicatorViewModel = new ProgressIndicatorViewModel();
         System.Diagnostics.Debug.Assert(object.ReferenceEquals(progressIndicatorViewModel, SingleInstanceApplication.Current.MainWindow.GetValue(ProgressIndicatorViewModelDataContextProperty)), "We got the wrong progress indicator visual!");
         ProgressIndicator.Initialize(progressIndicatorViewModel);
     }
 }
        /// <summary>
        /// Initialize the data context for the visual.
        /// </summary>
        /// <param name="window">Window for the progress indicator.</param>
        /// <param name="frame">Size to use for the indicator.</param>
        public void InitializeDataContext(NSWindow window, CGRect frame)
        {
            ViewModel  = new INTV.Shared.ViewModel.ProgressIndicatorViewModel(window);
            View.Frame = frame;
            var progressViewModel = ViewModel;

            // FIXME This is wrong! We should put the data context here, on the controller!
            View.DataContext = progressViewModel;
            RomListCommandGroup.CancelRomsImportCommand.CanExecute(progressViewModel); // EEEK TOTAL HACK
            progressViewModel.PropertyChanged += HandlePropertyChanged;
            ProgressBar.Indeterminate          = progressViewModel.IsIndeterminate;
        }