예제 #1
0
        public void GetData(Action<DataItem, Exception> callback)
        {
            // Use this to connect to the actual data service

            var item = new DataItem("Welcome to MVVM Light");
            callback(item, null);
        }
예제 #2
0
        public void GetData(Action<DataItem, Exception> callback)
        {
            // Use this to create design time data

            var item = new DataItem("Welcome to MVVM Light [design]");
            var province = new DataItem().ProvinceItem();
            callback(item, null);
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel(IDataService dataService)
        {
            _dataService = dataService;
            _dataService.GetData(
                (item, error) =>
                {
                    if (error != null)
                    {
                        // Report error here
                        return;
                    }

                    WelcomeTitle = item.Title;

                    Province = new DataItem().ProvinceItem();

                    GetCity = new RelayCommand<BaseInfo>((x) => ExecuteGetCity(x));
                    GetCityNext = new RelayCommand<BaseInfo>((x) => ExecuteGetCityNext(x));
                    ShowMessage = new RelayCommand<string>((x) => ExecuteShowMessage(x));
                });
        }
예제 #4
0
 private object ExecuteGetCityNext(BaseInfo baseinfo)
 {
     if (baseinfo != null)
     {
         b = baseinfo;
         CityNext = new DataItem().CityNextItem(baseinfo.Id);
     }
     return null;
 }
예제 #5
0
 private object ExecuteGetCity(BaseInfo baseinfo)
 {
     if (baseinfo != null)
     {
         a = baseinfo;
         City = new DataItem().CityItem(baseinfo.Name);
     }
     return null;
 }