public void MultipleModelsDependenciesTest() { List<string> property_notifications = new List<string>(); ModelA ma = new ModelA() { PropA = 1 }; ModelB mb = new ModelB() { PropB = 2 }; ViewModel vm = new ViewModel(ma, mb); int current_total; ma.PropertyChanged += (sender, args) => property_notifications.Add("ModelA:" + args.PropertyName); mb.PropertyChanged += (sender, args) => property_notifications.Add("ModelB:" + args.PropertyName); vm.PropertyChanged += (sender, args) => property_notifications.Add("ViewModel:" + args.PropertyName); ma.PropA = 2; Assert.AreEqual(2, property_notifications.Count); Assert.IsTrue(property_notifications.Contains("ModelA:PropA")); Assert.IsTrue(property_notifications.Contains("ViewModel:Total")); property_notifications.Clear(); mb.PropB = 40; Assert.AreEqual(2, property_notifications.Count); Assert.IsTrue(property_notifications.Contains("ModelB:PropB")); Assert.IsTrue(property_notifications.Contains("ViewModel:Total")); var total_property = TypeDescriptor.GetProperties(vm)["Total"]; var total = total_property.GetValue(vm); Assert.AreEqual(42, total); }
public void add_service_material() { // Setup new Bootstrap().Run(); Mocks.SERVICE_1.Materials.Clear(); Publish(Messages.REQUEST_SAVE_SERVICE, Mocks.SERVICE_1); Publish(Messages.REQUEST_SAVE_MATERIAL, Mocks.MATERIAL_1); Subscribe(Messages.REQUEST_SELECTED_SERVICE, obj => Publish(Messages.REQUEST_SELECTED_SERVICE_RESPONSE, Mocks.SERVICE_1)); var viewModel = new ViewModel(); // Test viewModel.SelectedMaterialFromCache = viewModel.Materials.FirstOrDefault(); viewModel.Add.Execute(null); // Verify var expected = viewModel.AssignedMaterials.Single() != null && !viewModel.Materials.Any(); Assert.IsTrue(expected); }
public BasicAuthorizationSetupViewModel(ViewModel parent, string prompt) : base(parent) { Prompt = prompt; RegisterCommand(OkCommand = new DelegateCommand<object>(Ok)); RegisterCommand(CancelCommand = new DelegateCommand<object>(Cancel)); }
public SettingsTabViewModel(ViewModel.MainWindowViewModel parentViewModel) { logger.Debug("Constructor of SettingsTabViewModel called"); logger.Debug("Is parent viewmodel null: " + (parentViewModel == null ? "true" : "false")); SettingsList = new ObservableCollection<TabItem>(); ArticleUnits = new ObservableCollection<Core.Utils.Unit>(); PaymentMethodes = new ObservableCollection<Core.Utils.PaymentMethode>(); DocumentFolder = new ObservableCollection<Core.Models.DocumentFolderModel>(); RegisteredExportClasses = new ObservableCollection<Core.Interfaces.IExport>(); PreferedExportClasses = new ObservableCollection<Core.Models.DocumentExportModel>(); RegisteredPlugins = new ObservableCollection<Interface.IPlugIn>(); RegisteredDatabases = new ObservableCollection<Core.Models.DatabaseUIModel>(); KeyValueStore = new Core.Utils.KeyValueStore(); logger.Debug("Creating new UnitTabItem"); SettingsList.Add(new SettingsList.UnitSettings.UnitTabItem()); SettingsList.Add(new SettingsList.PaymentSettings.PaymentTabItem()); SettingsList.Add(new SettingsList.TaxClassSettings.TaxClassTabItem()); SettingsList.Add(new SettingsList.ShipmentSettings.ShipmentTabItem()); TabContent = new SettingsTabContent() { DataContext = this }; RibbonTabItem = new SettingsTabRibbonTabItem(this) { DataContext = this }; ParentViewModel = parentViewModel; SelectedUnit = new Core.Utils.Unit(); SelectedPaymentMethode = new Core.Utils.PaymentMethode(); SelectedTaxClass = new Core.Utils.TaxClass(); SelectedShipment = new Core.Utils.Shipment(); logger.Info("Finished constructor of SettingsTabViewModel"); }
public void add_material() { // Setup var mock = new Mock(); mock.PrepareProfileDB(); mock.PrepareServicesDB(); mock.PrepareServiceMaterialsDB(); mock.PrepareQuotesDB(); mock.PrepareCustomersDB(); var materialsDB = mock.PrepareMaterialsDB(); new Autonomy().Activate(); var manageMaterialsViewModel = new ManageMaterials.ViewModel(); var viewModel = new ViewModel(); // Test viewModel.Name = SOME_TEXT; viewModel.Description = SOME_TEXT; viewModel.Quantity = SOME_DECIMAL_VALUE.ToString(); viewModel.UnitType = SOME_TEXT; viewModel.BaseCost = SOME_DECIMAL_VALUE.ToString(); viewModel.MarkupPrice = SOME_DECIMAL_VALUE.ToString(); viewModel.Save.Execute(null); // Verify var expected = viewModel.IsSaved && manageMaterialsViewModel.Materials.Single().Name == SOME_TEXT; Assert.IsTrue(expected); }
public SystemTypeViewModel( IViewModelDependencies appCtx, IZetboxContext dataCtx, ViewModel parent, Type type) : base(appCtx, dataCtx, parent) { _type = type; }
public async Task<ActionResult> Communication() { ViewData["time"] = DateTime.UtcNow.ToLongTimeString(); var productIds = _productsDb.Select(p => p.Id).ToList(); var vm = new ViewModel(UIKeysPubSubCache.Communication.ProductsDiv, page => page.Html.Action("Communication", new { model = productIds })); return ViewModel(vm); }
public ActionResult AddCustomer() { var model = new TestModel(); var vm = new ViewModel(UIKeysAreaTest.AddCustomer.PersonalData, p => p.Html.Action("AddCustomer", new { model })); //ViewModel.ExecuteResult results in: p => p.Html.Action("_View", new { controller = "Test", area = "TestArea", viewName = "AddCustomer", model = model, serviceKey = "CustomersService" }) return ViewModel(vm); }
/// <summary> /// Initializes a new instance of the <see cref="DefaultOperationView"/> class. /// </summary> public DefaultOperationView() { InitializeComponent(); _viewModel = new ViewModel(); this.DataContext = _viewModel; }
private Dictionary<string, string> GenParams(ViewModel.PaymentViewModel model) { var dict = new Dictionary<string, string>(); // 交易类型,前台只支持CONSUME 和 PRE_AUTH dict.Add("transType", UPOPSrv.TransType.CONSUME); // 商品URL dict.Add("commodityUrl",model.ProdUrl); // 商品名称 dict.Add("commodityName",model.ProdName); // 商品单价,分为单位 dict.Add("commodityUnitPrice",Ichari.Common.WebUtils.ConvertToFen(model.OrderModel.Total)); // 商品数量 dict.Add("commodityQuantity",model.OrderModel.OrderDetail.Sum(t => t.ProductCount).ToString()); // 订单号,必须唯一 dict.Add("orderNumber",model.OrderModel.TradeNo); // 交易金额 dict.Add("orderAmount", Ichari.Common.WebUtils.ConvertToFen(model.OrderModel.Total)); // 币种 dict.Add("orderCurrency",UPOPSrv.CURRENCY_CNY); // 交易时间 dict.Add("orderTime",model.OrderModel.CreateTime.ToString("yyyyMMddHHmmss")); // 用户IP dict.Add("customerIp",Request.UserHostAddress); // 前台回调URL dict.Add("frontEndUrl",model.FrontCallbackUrl); // 后台回调URL(前台请求时可为空) dict.Add("backEndUrl",model.BackCallbackUrl); return dict; }
public MainWindow() { var dataModel = new ViewModel<Model>(new {Name = "sam"}); dataModel.When(x=>x.Name,"Thelonious").Set(x=>x.Age,51); DataContext = dataModel; InitializeComponent(); }
public async Task<IViewComponentResult> InvokeAsync() { var viewModel = new ViewModel("Alexander Pierce", "~/lib/admin-lte/dist/img/user2-160x160.jpg", "img-circle", "Main Navigation"); return View(viewModel); }
/// <summary> /// Initializes a new instance of the <see cref="ExportTypeEditor"/> class. /// </summary> public ExportTypeEditor() { InitializeComponent(); _viewModel = new ViewModel(); this.DataContext = _viewModel; }
public VideoInfo(ViewModel.INode node) : this() { Context = node; LoadVideoDetails(); }
public void Submit(ViewModel.PaymentViewModel model) { var order = _uow.OrderService.Get(t => t.OrderId == model.OrderId && t.TradeNo == model.TradeNo); if (order == null) Response.Redirect("PayError"); model.OrderModel = order; model.FrontCallbackUrl = Ichari.Common.WebUtils.GetAppSettingValue("FrontPayUrl"); model.BackCallbackUrl = Ichari.Common.WebUtils.GetAppSettingValue("BackPayUrl"); if (model.Source == Model.Enum.PaySource.Donation) { model.ProdUrl = Ichari.Common.WebUtils.GetAppSettingValue("DonateUrl"); model.ProdName = Ichari.Common.WebUtils.GetAppSettingValue("DonationName"); } switch (model.PayWayType) { case PayWay.UnionPay : // 要使用各种Srv必须先使用LoadConf载入配置 UPOPSrv.LoadConf(Server.MapPath("~/conf.xml.config")); var p = GenParams(model); var srv = new FrontPaySrv(p); //写入订单支付记录 SavePayLog(model); Response.ContentEncoding = srv.Charset; _log.Info(srv.CreateHtml()); Response.Write(srv.CreateHtml()); break; } }
public void Display_view_model() { var vm = new ViewModel { GameScore = 12, GameFinished = true }; var frames = new List<ListViewItem>(); for (var i = 12; i > 0; i--) { var lvm = new ListViewItem(i.ToString()); lvm.SubItems.Add(i.ToString()); lvm.SubItems.Add((i+1).ToString()); lvm.SubItems.Add((i + i + 1).ToString()); frames.Add(lvm); } vm.Frames = frames; var sut = new UI(); sut.Display(vm); sut.ShowDialog(); }
public void CollectionPropertyDependencyTest() { List<string> property_notifications = new List<string>(); Model m = new Model(); m.Items.Add(new Item() { Prop = 42 }); m.Items.Add(new Item() { Prop = 23 }); m.Items.Add(new Item() { Prop = 17 }); ViewModel vm = new ViewModel(m); m.PropertyChanged += (sender, args) => property_notifications.Add("Model:" + args.PropertyName); vm.PropertyChanged += (sender, args) => property_notifications.Add("ViewModel:" + args.PropertyName); var item = new Item() { Prop = 1 }; item.PropertyChanged += (sender, args) => property_notifications.Add("Item:" + args.PropertyName); m.Items.Add(item); Assert.AreEqual(1, property_notifications.Count); Assert.IsTrue(property_notifications.Contains("ViewModel:Items")); property_notifications.Clear(); item.Prop = 42; Assert.AreEqual(3, property_notifications.Count); Assert.IsTrue(property_notifications.Contains("Item:Prop")); Assert.IsTrue(property_notifications.Contains("ViewModel:Items")); // Called by Item.Prop changed Assert.IsTrue(property_notifications.Contains("ViewModel:Items")); // Called by ItemViewModel.PropSquared property_notifications.Clear(); m.Items.Remove(item); Assert.AreEqual(1, property_notifications.Count); Assert.IsTrue(property_notifications.Contains("ViewModel:Items")); }
private void AsyncLoadPositions(ViewModel[] viewModels) { AsyncHelper.InvokeSafe(() => { foreach (var model in viewModels) { var positions = (RF.Find<OrgPosition>() as OrgPositionRepository) .GetList(model.UserId).Cast<OrgPosition>().ToList(); if (positions.Count > 0) { var positionResult = new StringBuilder(); for (int i = 0, c = positions.Count; i < c; i++) { var item = positions[i]; if (i != 0) { positionResult.Append('/'); } positionResult.Append(item.View_Name); } model.Position = positionResult.ToString(); } } }); }
public AssemblyViewModel( IViewModelDependencies appCtx, IZetboxContext dataCtx, ViewModel parent, Assembly obj) : base(appCtx, dataCtx, parent, obj) { _assembly = obj; }
public override ViewBase AnimalCollectionsCreateView(ViewModel viewModel) { AnimalViewModel animalVM = viewModel as AnimalViewModel; GameObject prefabSelected = null; switch (animalVM.AnimalType) { case AnimalType.BLUE_BIRD: prefabSelected = this.AnimalsPrefab [0]; break; case AnimalType.COFFEE_COW: prefabSelected = this.AnimalsPrefab [1]; break; case AnimalType.GREEN_FROG: prefabSelected = this.AnimalsPrefab [2]; break; default: break; } string name = Locator.Loc2Name (new Loc (){ x = animalVM.Loc.x, y = animalVM.Loc.y }); // GameObject containerObj = MapContainerObj.transform.FindChild (name).gameObject; ViewBase animalV = InstantiateView (prefabSelected, viewModel); animalV.gameObject.transform.position = InGameRootViewHelper.Loc2Pos (animalVM.Loc); animalV.gameObject.transform.FindChild ("Sprite").gameObject.GetComponent<SpriteRenderer> ().color = new Color (1, 1, 1, 0); return animalV; }
public UserControl GetRender(ViewModel parent, Response r) { string text = r.Decode<string>(); TextViewModel vm = new TextViewModel(parent, text); return new TextRender(vm); }
public Task<ViewResult> Index() { return Task<ViewResult>.Factory.StartNew(() => { using (var client = new NewsServiceClient()) { var timer = new Stopwatch(); timer.Start(); var worldNews = client.GetWorldNews(); var sportNews = client.GetSportNews(); var funNews = client.GetFunNews(); var result = worldNews .Union(sportNews) .Union(funNews) .Convert(); timer.Stop(); var model = new ViewModel { News = result, Elapsed = timer.Elapsed }; return View(model); } }); }
public Task<ViewResult> Index2() { var tcs = new TaskCompletionSource<ViewResult>(); var client = new ServiceDecorator(new NewsServiceClient()); var timer = new Stopwatch(); timer.Start(); var worldNews = client.GetWorldNewsTaskAsync(); var sportNews = client.GetSportNewsTaskAsync(); var funNews = client.GetFunNewsTaskAsync(); var allNews = Task.WhenAll(worldNews, sportNews, funNews); allNews.ContinueWith(r => { IEnumerable<NewsModel> result = new List<NewsModel>(); result = r.Result.Aggregate(result, (current, news) => current.Concat(news.Convert())); var model = new ViewModel { News = result, Elapsed = timer.Elapsed }; tcs.SetResult(View("Index", model)); timer.Stop(); }); return tcs.Task; }
public ActionResult Add(ViewModel.Newsletter.newsletterItem item) { if (db.tbl_newsletterUser.Any(a => a.email == item.email)) { return Json(new { isSuccess = "No", msg = lang.mailExist }); } try { if (ModelState.IsValid) { var newItem = new tbl_newsletterUser(); newItem.email = item.email; newItem.createTime = DateTime.Now; newItem.ipNo = getUserIP(); db.tbl_newsletterUser.Add(newItem); db.SaveChanges(); return Json(new { isSuccess = "Ok", msg = lang.newsletterSuccessMsg }); } else { string errorMessages = string.Join("<br />", ModelState.Values.Where(E => E.Errors.Count > 0).SelectMany(E => E.Errors).Select(E => E.ErrorMessage).ToArray()); return Json(new { isSuccess = "No", msg = errorMessages }); } } catch (Exception ex) { errorSend(ex, "Newsletter Kayıt İşleminde"); return Json(new { isSuccess = "No", msg = lang.unexpectedErrorMsg }); } }
public Result OnStartup(UIControlledApplication application) { ThisApp = this; var elementCategoryFilter = new ElementCategoryFilter(BuiltInCategory.OST_GenericAnnotation); _updaterModified = new UpdaterModified(application.ActiveAddInId); if (!UpdaterRegistry.IsUpdaterRegistered(_updaterModified.GetUpdaterId())) { UpdaterRegistry.RegisterUpdater(_updaterModified); UpdaterRegistry.AddTrigger(_updaterModified.GetUpdaterId(), elementCategoryFilter, Element.GetChangeTypeAny()); } _updaterAdded = new UpdaterAdded(application.ActiveAddInId); if (!UpdaterRegistry.IsUpdaterRegistered(_updaterAdded.GetUpdaterId())) { UpdaterRegistry.RegisterUpdater(_updaterAdded); UpdaterRegistry.AddTrigger(_updaterAdded.GetUpdaterId(), elementCategoryFilter, Element.GetChangeTypeElementAddition()); } _paneId = new DockablePaneId(Guid.NewGuid()); _handler = new RequestHandler(); _exEvent = ExternalEvent.Create(_handler); _sheetNoteModel = new ViewModel(); _mainPage = new MainPage { Resources = {["ViewModel"] = _sheetNoteModel } }; application.RegisterDockablePane(_paneId, "Sheet Note Manager", (IDockablePaneProvider)_mainPage); application.ControlledApplication.DocumentClosed += new EventHandler<DocumentClosedEventArgs>(OnDocumentClosed); application.ControlledApplication.DocumentOpened += new EventHandler<DocumentOpenedEventArgs>(OnDocumentOpened); return Result.Succeeded; }
private ViewModel.QuestionSet AddEntity(ViewModel.QuestionSet entity) { // Create the new entity var qs = this.uow.Context.QuestionSets.Create(); qs.Title = entity.Title; qs.QuestionSetType = uow.Context.QuestionSetTypes.FirstOrDefault(x => x.Id == entity.QuestionSetTypeId); qs.Active = entity.Active; qs.ValidFrom = DateTime.Now; this.uow.Context.QuestionSets.Add(qs); // Add each question to this question set // Each question should exist in the database already, so we allow // this to fail with an exception if it does not foreach (var question in entity.Questions) { qs.Questions.Add(this.uow.Context.Questions.FirstOrDefault(x => x.Id == question)); } // Submit the changes to the database this.uow.Save(); // We now have a database Id for this entity entity.Id = qs.Id; return entity; }
public void update_service() { // Setup new Bootstrap().Run(); Publish(Messages.REQUEST_SAVE_SERVICE, Mocks.SERVICE_1); var servicesViewModel = new ManageServices.ViewModel(); servicesViewModel.Load.Execute(null); var viewModel = new ViewModel(); // Test var service = servicesViewModel.Services.First(); viewModel.ServiceToUpdate = servicesViewModel.Services.First(); viewModel.Name = SOME_OTHER_TEXT; viewModel.Materials = service.Materials; viewModel.TaxPercentage = service.TaxPercentage.ToString(); viewModel.LaborCost = service.LaborCost.ToString(); viewModel.Description = service.Description; viewModel.Update.Execute(null); // Verify var expected = viewModel.IsUpdated && Mocks.SERVICE_1.Name == SOME_OTHER_TEXT; Assert.IsTrue(expected); }
public ActivityLauncher( ActivityService activityService, ViewModel.Factory viewModelFactory) { this.activityService = activityService; this.viewModelFactory = viewModelFactory; }
public MainWindow() { var vm = new ViewModel(); DataContext = vm; InitializeComponent(); }
public ObjectClassViewModel(IViewModelDependencies appCtx, IZetboxContext dataCtx, ViewModel parent, ObjectClass cls) : base(appCtx, dataCtx, parent, cls) { _cls = cls; cls.PropertyChanged += ModulePropertyChanged; }
public FontSize(ViewModel vm) : this() { DataContext = vm; }
public Signal(ViewModel viewModel, IEventAggregator aggregator) { _viewModel = viewModel; }
public Signal(ViewModel viewModel) { _viewModel = viewModel; }
public void OnCreateNewTag(TagData newTagData) { ViewModel.AddTag(newTagData); }
public ConcludeUserControl(ViewModel model) { this.InitializeComponent(); DataContext = model; }
protected void Transition(ViewModel viewModel, Type windowType, TransitionMode mode, bool isOwned) { var message = new TransitionMessage(windowType, viewModel, mode, isOwned ? "Window.Transition.Child" : "Window.Transition"); this.Messenger.Raise(message); }
public SettingsLocale() { InitializeComponent(); DataContext = new ViewModel(); }
private void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs args) { ViewModel.ShareContent(args.Request); }
public void OnChangeDuration(TimeSpan newDuration) { ViewModel.ChangeTimeEntryDuration(newDuration); }
public void OnModifyTagList(List <TagData> newTagList) { ViewModel.ChangeTagList(newTagList); }
public CalendarPage() { InitializeComponent(); this.ViewModel = (CalendarPageViewModel)BindingContext; ViewModel.SetView(this); }
public async override void OnViewCreated(View view, Bundle savedInstanceState) { base.OnViewCreated(view, savedInstanceState); ViewModel = await EditTimeEntryViewModel.Init(TimeEntryId); // TODO: in theory, this event could be binded but // the event "CheckedChange" isn't found when // the app is compiled for release. Investigate! BillableCheckBox.CheckedChange += (sender, e) => { ViewModel.ChangeBillable(BillableCheckBox.Checked); }; DescriptionField.TextField.TextChanged += (sender, e) => { ViewModel.ChangeDescription(DescriptionField.TextField.Text); }; DurationTextView.Click += (sender, e) => { // TODO: Don't edit duration if Time entry is running? if (ViewModel.IsRunning) { return; } ChangeTimeEntryDurationDialogFragment.NewInstance(ViewModel.StopDate, ViewModel.StartDate) .SetChangeDurationHandler(this) .Show(FragmentManager, "duration_dialog"); }; StartTimeEditText.Click += (sender, e) => { var title = GetString(Resource.String.ChangeTimeEntryStartTimeDialogTitle); ChangeDateTimeDialogFragment.NewInstance(ViewModel.StartDate, title) .SetOnChangeTimeHandler(this) .Show(FragmentManager, "start_time_dialog"); }; StopTimeEditText.Click += (sender, e) => { var title = GetString(Resource.String.ChangeTimeEntryStopTimeDialogTitle); ChangeDateTimeDialogFragment.NewInstance(ViewModel.StopDate, title) .SetOnChangeTimeHandler(this) .Show(FragmentManager, "stop_time_dialog"); }; ProjectField.TextField.Click += (sender, e) => OpenProjectListActivity(); ProjectField.Click += (sender, e) => OpenProjectListActivity(); TagsField.OnPressTagField += OnTagsEditTextClick; durationBinding = this.SetBinding(() => ViewModel.Duration, () => DurationTextView.Text); startTimeBinding = this.SetBinding(() => ViewModel.StartDate, () => StartTimeEditText.Text) .ConvertSourceToTarget(dateTime => dateTime.ToDeviceTimeString()); stopTimeBinding = this.SetBinding(() => ViewModel.StopDate, () => StopTimeEditText.Text) .ConvertSourceToTarget(dateTime => dateTime.ToDeviceTimeString()); projectBinding = this.SetBinding(() => ViewModel.ProjectName, () => ProjectField.TextField.Text); clientBinding = this.SetBinding(() => ViewModel.ClientName, () => ProjectField.AssistViewTitle); tagBinding = this.SetBinding(() => ViewModel.TagList, () => TagsField.TagNames) .ConvertSourceToTarget(tagList => tagList.Select(tag => tag.Name).ToList()); descriptionBinding = this.SetBinding(() => ViewModel.Description, () => DescriptionField.TextField.Text); isPremiumBinding = this.SetBinding(() => ViewModel.IsPremium, () => BillableCheckBox.Visibility) .ConvertSourceToTarget(isVisible => isVisible ? ViewStates.Visible : ViewStates.Gone); isRunningBinding = this.SetBinding(() => ViewModel.IsRunning).WhenSourceChanges(() => { StopTimeEditText.Visibility = ViewModel.IsRunning ? ViewStates.Gone : ViewStates.Visible; stopTimeEditLabel.Visibility = ViewModel.IsRunning ? ViewStates.Gone : ViewStates.Visible; }); isBillableBinding = this.SetBinding(() => ViewModel.IsBillable, () => BillableCheckBox.Checked); billableBinding = this.SetBinding(() => ViewModel.IsBillable) .WhenSourceChanges(() => { var label = ViewModel.IsBillable ? GetString(Resource.String.CurrentTimeEntryEditBillableChecked) : GetString(Resource.String.CurrentTimeEntryEditBillableUnchecked); BillableCheckBox.Text = label; }); // Configure option menu. ConfigureOptionMenu(); // If project list needs to be opened? var settingsStore = ServiceContainer.Resolve <SettingsStore> (); if (settingsStore.ChooseProjectForNew && LogTimeEntriesListFragment.NewTimeEntry) { LogTimeEntriesListFragment.NewTimeEntry = false; OpenProjectListActivity(); } // Finally set content visible. editTimeEntryContent.Visibility = ViewStates.Visible; editTimeEntryProgressBar.Visibility = ViewStates.Gone; if (LogTimeEntriesListFragment.NewTimeEntry) { DescriptionField.RequestFocus(); ((EditTimeEntryActivity)Activity).ShowSoftKeyboard(DescriptionField.TextField, false); } }
//Meghivja a ViewModel book reszletezeseert felelos fuggvenyet private void ListView_ItemClick(object sender, ItemClickEventArgs e) { ViewModel.SelectBook((Book)e.ClickedItem); }
public AcSettingsSystem() { InitializeComponent(); DataContext = new ViewModel(); this.AddWidthCondition(1080).Add(v => Grid.Columns = v ? 2 : 1); }
private void ReplaceItem(int index, ViewModel vm) { RemoveItem(index); AddItem(index, vm); }
//Meghivja a ViewModel Boritokepre navigalo fuggvenyet //ami egy uj lapot nyit a boritokeppel ha van a konyvnek private void Image_Tapped(object sender, TappedRoutedEventArgs e) { ViewModel.NavigateToImage(); }
public MainWindow(ViewController controller) { InitializeComponent(); _controller = controller; ViewModel = _controller.GetTestModel(); }
public SoundEditor(EngineDescription buildInfo, string cacheLocation, TagEntry tag, ICacheFile cache, IStreamManager streamManager) { InitializeComponent(); /* * This was been fixed up to support the changes that came from sound injection, but has not really been tested * but it still isn't great/complete and was mainly only done so I didn't leave in a control where most of its code has been commented out and broken * not to mention this is all moot with MCC using external proprietary files for sounds * if i had to complete it, id probably add extra methods to SoundResourceTable and SoundGestalt to grab pitch ranges on demand instead of loading in everything every time * -Zedd */ _buildInfo = buildInfo; _cacheLocation = cacheLocation; _tag = tag; _cache = cache; _streamManager = streamManager; var viewModel = new ViewModel(); DataContext = viewModel; viewModel.TagName = _tag.TagFileName; viewModel.Sound = _sound; if (!_cache.ResourceMetaLoader.SupportsSounds) { IsEnabled = false; MetroMessageBox.Show("Unsupported", "Assembly doesn't support sounds on this build of Halo yet."); return; } using (var reader = _streamManager.OpenRead()) { // load gestalt if (_cache.SoundGestalt != null) { _soundResourceTable = _cache.SoundGestalt.LoadSoundResourceTable(reader); } _sound = _cache.ResourceMetaLoader.LoadSoundMeta(_tag.RawTag, reader); var resourceTable = _cache.Resources.LoadResourceTable(reader); _soundResource = resourceTable.Resources.First(r => r.Index == _sound.ResourceIndex); _resourcePages = new [] { _soundResource.Location.PrimaryPage, _soundResource.Location.SecondaryPage, _soundResource.Location.TertiaryPage, }; viewModel.ResourcePages = new ObservableCollection <ResourcePage>(_resourcePages.ToList()); } for (int i = 0; i < _sound.PitchRangeCount; i++) { var pitchrange = _soundResourceTable.PitchRanges[_sound.FirstPitchRangeIndex + i]; foreach (var permutation in pitchrange.Permutations) { viewModel.Permutations.Add(new ViewModel.ViewPermutation { Name = _cache.StringIDs.GetString(permutation.Name), Index = i, SoundPermutation = permutation }); } } }
private void SetActiveDateProperty() { DateTime start = mData.GetStartTime(); DateTime end = mData.GetEndTime(); string display = string.Format( DATE_AVAILABLE_FORMAT, start.ToString(), end.ToString() ); ViewModel.SetProperty( DATE_AVAILABLE_PROPERTY, display ); }
void MakeGameControl() { ControlsGrid = new Grid { Margin = new Thickness(10, 10, 10, 10), HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.StartAndExpand, BackgroundColor = BackgroundColor, HeightRequest = ViewModel.ScreenWidth / 2.5, WidthRequest = ViewModel.ScreenWidth / 2.5, RowSpacing = 6, ColumnSpacing = 6, }; ControlsGrid.RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } }; ControlsGrid.ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } }; for (int i = 0; i < 4; i++) { string dir = ViewModel.Controls[i / 2][i % 2]; ControlsImages[i / 2, i % 2] = SKBitmap.Decode (Helper.getResourceStream("Images." + ViewModel.ControlsImagesNames[dir] + ".png")); } for (int i = 0; i < 2; i++) { SKCanvasView curCanvas = new SKCanvasView(); CanvasView[i] = curCanvas; int id = i; var actionTap = new TapGestureRecognizer(); actionTap.Tapped += async(s, e) => { await ViewModel.MakeTurn(id); }; curCanvas.GestureRecognizers.Add(actionTap); if (ViewModel.ChooseRow) { ControlsGrid.Children.Add(curCanvas, 0, i); Grid.SetColumnSpan(curCanvas, 2); Grid.SetRowSpan(curCanvas, 1); } else { ControlsGrid.Children.Add(curCanvas, i, 0); Grid.SetColumnSpan(curCanvas, 1); Grid.SetRowSpan(curCanvas, 2); } curCanvas.Opacity = 0.7; } }
private void SetTitleProperty() { string title = mStringTable.Get( mData.GetNameKey() ); ViewModel.SetProperty( TITLE_PROPERTY, title ); }
private void ClearButton_Click(object sender, RoutedEventArgs e) { ViewModel.Clear(Key); }
public MapWithItemsSourceGallery() { InitializeComponent(); BindingContext = new ViewModel(); _map.MoveToRegion(MapSpan.FromCenterAndRadius(startPosition, Distance.FromMiles(1200))); }
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) { ViewModel.Unload(); ViewModel.Unsubscribe(); }
async public Task LoadLeagues() { await ViewModel.GetLeaguesForAthlete(); }
protected override void OnNavigatedTo(NavigationEventArgs e) { ViewModel.Init(e.Parameter as AnimeListPageNavigationArgs); }
public void Previous() { ViewModel.Previous(); }
protected override void OnDisappearing() { ViewModel.CancelTasks(); base.OnDisappearing(); }
public void Next() { ViewModel.Next(); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { ViewModel.Subscribe(); await ViewModel.LoadAsync(e.Parameter as GroupsListArgs); }