void InitBindings() { mvvmContext1.RegisterService(DialogService.CreateXtraDialogService(this, "Details")); mvvmContext1.RegisterService(DispatcherService.Create()); var mvvm = mvvmContext1.OfType <TrackListViewModel>(); mvvm.SetBinding(gridView1, x => x.LoadingPanelVisible, x => x.IsLoading); mvvm.WithEvent <EventArgs>(this, "Load").EventToCommand(x => x.LoadTracks()); mvvm.WithEvent <ColumnView, FocusedRowObjectChangedEventArgs>(gridView1, "FocusedRowObjectChanged") .SetBinding(x => x.CurrentItem, args => args.Row as TrackViewModel, (gView, track) => gView.FocusedRowHandle = gView.FindRow(track)); mvvm.WithEvent <RowClickEventArgs>(gridView1, "RowClick") .EventToCommand( x => x.EditItem(null), x => x.CurrentItem, args => (args.Clicks == 2) && (args.Button == MouseButtons.Left)); mvvmContext1.RegisterService(new CustomReportService(gridView1)); mvvm.BindCommand(barButtonItem1, x => x.ShowReport()); mvvm.SetBinding(repositoryItemLookUpEditAlbum, e => e.DataSource, x => x.CurrentItem.AlbumLookupData); }
private bool ValidateProperties() { string error; if (!Templates.ValidateProperties(out error)) { DialogHelper.BlockingMessageBox(DispatcherService.Create(), error, EditorPath.EditorTitle, MessageBoxButton.OK, MessageBoxImage.Error); return(false); } return(true); }
static IDispatcherService CreateDispatcher() { var initializationSignal = new AutoResetEvent(false); IDispatcherService result = null; var dispatcherThread = new Thread(() => { result = DispatcherService.Create(); initializationSignal.Set(); Dispatcher.Run(); }); dispatcherThread.Start(); initializationSignal.WaitOne(); return(result); }
protected override async Task <bool> PrepareAssetCreation(AssetTemplateGeneratorParameters parameters) { var description = (TemplateAssetDescription)parameters.Description; var assetType = description.GetAssetType(); var files = parameters.SourceFiles.Count > 0 ? parameters.SourceFiles : await BrowseForSourceFiles(description, true); while (files == null) { var assetTypeName = TypeDescriptorFactory.Default.AttributeRegistry.GetAttribute <DisplayAttribute>(assetType)?.Name ?? assetType.Name; var buttons = DialogHelper.CreateButtons(new[] { Tr._p("Button", "Create"), Tr._p("Button", "Select a source..."), Tr._p("Button", "Cancel") }, 1, 3); var result = await DialogHelper.MessageBox(DispatcherService.Create(), string.Format(Tr._p("Message", "Do you want to create this {0} without a source file?"), assetTypeName), EditorViewModel.Instance.EditorName, buttons, MessageBoxImage.Question); // Close without clicking a button or Cancel if (result == 0 || result == 3) { return(false); } // Create without source if (result == 1) { break; } // Display the file picker again files = await BrowseForSourceFiles(description, true); } parameters.Tags.Add(SourceFilesPathKey, files); return(await base.PrepareAssetCreation(parameters)); }