Пример #1
0
        public BookViewModel(
                    BookModel bookModel, string pageTitle,
                    INavigationServiceFacade navigationServiceFacade,
                    bool synchronizedWithSelection)
        {
            this._book = bookModel;
            this._pageTitle = pageTitle;
            this._navigationServiceFacade = navigationServiceFacade;

            if (_categoryService != null)
                this._categories =
                    new ObservableCollection<CategoryModel>(this._categoryService.GetByCriteria(CategoryCriteria.Empty));

            if (_authorService != null)
                this._authors =
                    new ObservableCollection<AuthorModel>(this._authorService.GetByCriteria(AuthorCriteria.Empty));

            #region Initialisation supplémentaire pour problème dans le ListPicker

            IEnumerator enumcat = this._categories.GetEnumerator();
            enumcat.MoveNext();
            _selectedCategory = enumcat.Current as CategoryModel;

            IEnumerator enumaut = this._authors.GetEnumerator();
            enumaut.MoveNext();
            _selectedAuthor = enumaut.Current as AuthorModel;

            #endregion // Initialisation supplémentaire pour problème dans le ListPicker
        }
 public static void NavigateWithIndex(INavigationServiceFacade navigationServiceFacede, int landOnPageIndex = 0)
 {
     navigationServiceFacede.Navigate(
         new Uri(
             "/Pages/AdvancedSettings/AdvancedSettingsView.xaml?Index=" +
             landOnPageIndex, UriKind.Relative));
 }
        public AdvancedSettingsViewModel(
			INavigationServiceFacade navigationServiceFacade,
			IIsolatedStorageServiceFacade isolatedStorageServiceFacade)
        {
            this.navigationServiceFacade = navigationServiceFacade;
            this.isolatedStorageServiceFacade = isolatedStorageServiceFacade;

            // Generate zoom values
            this.ActivateZoomValuesList = new List<int>() {
                200,
                400,
                600,
                1000,
                1600
            };

            // Generate row values
            this.FavoriteRowsList = new List<int>() {
                2,
                3,
                4
            };

            // Generate refresh rates
            this.RefreshRatesList = new List<int>() {
                200,
                500,
                1000,
                5000
            };

            this.LoadSettings();
        }
Пример #4
0
 public CategoryViewModel(
             CategoryModel categoryModel, 
             string pageTitle, 
             INavigationServiceFacade navigationServiceFacade, 
             bool synchronizedWithSelection)
 {
     this._category = categoryModel;
     this._pageTitle = pageTitle;
     this._navigationServiceFacade = navigationServiceFacade;
 }
Пример #5
0
 public AuthorViewModel(
             AuthorModel authorModel, 
             string pageTitle, 
             INavigationServiceFacade navigationServiceFacade, 
             bool synchronizedWithSelection)
 {
     this._author = authorModel;
     this._pageTitle = pageTitle;
     this._navigationServiceFacade = navigationServiceFacade;
 }
Пример #6
0
        public VisionViewModel(INavigationServiceFacade navigationServiceFacade,
							   IIsolatedStorageServiceFacade isolatedStorageServiceFacade,
							   IRelayServiceFacade relayServiceFacade)
        {
            if (navigationServiceFacade == null)
                throw new ArgumentNullException("navigationServiceFacade");
            if (isolatedStorageServiceFacade == null)
                throw new ArgumentNullException("isolatedStorageServiceFacade");
            if (relayServiceFacade == null)
                throw new ArgumentNullException("relayServiceFacade");

            this.navigationServiceFacade = navigationServiceFacade;
            this.isolatedStorageServiceFacade = isolatedStorageServiceFacade;
            this.relayServiceFacade = relayServiceFacade;
        }
Пример #7
0
 // Constructeur de copie
 public BookViewModel(BookViewModel bvm)
 {
     this._authors = bvm._authors;
     this._authorService = bvm._authorService;
     this._book = bvm.Book;
     this._categories = bvm._categories;
     this._categoryService = bvm._categoryService;
     this._isNewPhoto = bvm._isNewPhoto;
     this._navigationServiceFacade = bvm._navigationServiceFacade;
     this._pageTitle = bvm._pageTitle;
     this._rates = bvm._rates;
     this._selectedAuthor = bvm._selectedAuthor;
     this._selectedCategory = bvm._selectedCategory;
     this._state = bvm._state;
     this._windowServices = bvm._windowServices;
 }
Пример #8
0
        public MainViewModel(INavigationServiceFacade navigationServiceFacade,
			IIsolatedStorageServiceFacade isolatedStorageServiceFacade,
			IRelayServiceFacade relayServiceFacade)
        {
            if (navigationServiceFacade == null)
                throw new ArgumentNullException("navigationServiceFacade");
            if (isolatedStorageServiceFacade == null)
                throw new ArgumentNullException("isolatedStorageServiceFacade");
            if (relayServiceFacade == null)
                throw new ArgumentNullException("relayServiceFacade");

            this.navigationServiceFacade = navigationServiceFacade;
            this.isolatedStorageServiceFacade = isolatedStorageServiceFacade;
            this.relayServiceFacade = relayServiceFacade;

            this.FavoriteModules = new ObservableCollection<ModuleModel>();
            this.AvailableModules = new ObservableCollection<ModuleModel>();

            this.LoadSettings();
            this.LoadModules();

            // Set connection info
            this.IsConnected = this.relayServiceFacade.Proxy.IsConnected;
            this.relayServiceFacade.Proxy.OnOpened += proxy => this.IsConnecting = false;
            this.relayServiceFacade.Proxy.OnClosed += proxy => this.IsConnecting = true;
            this.timer = new DispatcherTimer() {Interval = TimeSpan.FromSeconds(10)};
            this.timer.Tick += (sender, args) => {
                this.IsConnecting = !this.relayServiceFacade.Proxy.IsConnected;

                // Show error message if got disconnected
                if (!this.IsConnected) {
                    MessageBox.Show(
                        "Couldn't connect to server. Check your internet connection...", "SyncUp",
                        MessageBoxButton.OK);
                    this.timer.Stop();
                }
            };
            this.timer.Start();

            this.log.Info("View model created");
        }
Пример #9
0
        public LightsViewModel(INavigationServiceFacade navigationServiceFacade,
							   IIsolatedStorageServiceFacade isolatedStorageServiceFacade,
							   IRelayServiceFacade relayServiceFacade)
        {
            if (navigationServiceFacade == null)
                throw new ArgumentNullException("navigationServiceFacade");
            if (isolatedStorageServiceFacade == null)
                throw new ArgumentNullException("isolatedStorageServiceFacade");
            if (relayServiceFacade == null)
                throw new ArgumentNullException("relayServiceFacade");

            this.navigationServiceFacade = navigationServiceFacade;
            this.isolatedStorageServiceFacade = isolatedStorageServiceFacade;
            this.relayServiceFacade = relayServiceFacade;

            // Set initial values
            this.Lights = new List<Light>();
            this.IsLoadingLights = true;

            // Initiate first lights list request
            this.RefreshLightsListAsync();
        }
Пример #10
0
        public PlayViewModel(INavigationServiceFacade navigationServiceFacade,
							 IIsolatedStorageServiceFacade isolatedStorageServiceFacade,
							 IRelayServiceFacade relayServiceFacade)
        {
            if (navigationServiceFacade == null)
                throw new ArgumentNullException("navigationServiceFacade");
            if (isolatedStorageServiceFacade == null)
                throw new ArgumentNullException("isolatedStorageServiceFacade");
            if (relayServiceFacade == null)
                throw new ArgumentNullException("relayServiceFacade");

            this.navigationServiceFacade = navigationServiceFacade;
            this.isolatedStorageServiceFacade = isolatedStorageServiceFacade;
            this.relayServiceFacade = relayServiceFacade;

            this.IsPlaying = false;
            this.IsShuffleEnabled = false;
            this.IsRepeatEnabled = false;
            this.SongName = "Unknown";
            this.ArtistName = "Unknown";
            this.SongLength = 0;
            this.SongPosition = 0;

            // TODO remove, only sample
            this.IsPlaying = false;
            this.IsShuffleEnabled = false;
            this.IsRepeatEnabled = false;
            this.SongName = "I Need A Dollar";
            this.ArtistName = "Aloe Blacc";
            this.SongLength = 258;
            this.SongPosition = 47;

            var timer = new DispatcherTimer() {
                Interval = TimeSpan.FromMilliseconds(1000)
            };
            timer.Tick += (sender, args) =>
                this.SongPosition++;
            timer.Start();
        }
Пример #11
0
        public CreateClientViewModel(INavigationServiceFacade navigationServiceFacade,
		                             IIsolatedStorageServiceFacade isolatedStorageServiceFacade)
        {
            this.navigationServiceFacade = navigationServiceFacade;
            this.isolatedStorageServiceFacade = isolatedStorageServiceFacade;
        }
Пример #12
0
 public MainViewModel(INavigationServiceFacade navigationServiceFacade)
 {
     this._navigationServiceFacade = navigationServiceFacade;
 }