private void Initialize() { _title = Resources.Strings.MainWindowTitle; _romList = new RomListViewModel(); _romList.PropertyChanged += HandleRomListViewModelPropertyChanged; _ltoFlashViewModel = new INTV.LtoFlash.ViewModel.LtoFlashViewModel(); _ltoFlashViewModel.PropertyChanged += HandleLtoFlashViewModelPropertyChanged; _romList.CollectionChanged += HandleRomListChanged; this.DoImport(); DefaultSelectedRomCommand = INTV.LtoFlash.Commands.DownloadCommandGroup.DownloadAndPlayCommand; }
/// <summary> /// Mac-specific implementation. /// </summary> /// <param name="viewModel">View model.</param> static partial void RestoreRomListComplete(RomListViewModel viewModel) { SortRoms(); }
/// <summary> /// Initializes a new instance of ValidateRomsTaskData. /// </summary> /// <param name="task">The task that executes, using an instance of this type as data.</param> /// <param name="romListViewModel">The ROM list ViewModel being refreshed.</param> internal ValidateRomsTaskData(AsyncTaskWithProgress task, RomListViewModel romListViewModel) : base(task) { RomListViewModel = romListViewModel; UpdatedRoms = new List <INTV.Core.Model.Program.ProgramDescription>(); }
/// <summary> /// Initializes a new instance of the /// <see cref="INTV.Shared.Commands.RomListCommandGroup+RestoreRomListTaskData"/> class. /// </summary> /// <param name="task">The asynchronous task to execute the action.</param> /// <param name="fileToRestore">The ROM list backup file to restore.</param> /// <param name="romListViewModel">The ViewModel to inform of the restoration when complete.</param> internal RestoreRomListTaskData(AsyncTaskWithProgress task, string fileToRestore, RomListViewModel romListViewModel) : base(task) { FileToRestore = fileToRestore; RomListViewModel = romListViewModel; }
/// <summary> /// Initializes a new instance of the <see cref="INTV.Shared.View.RomListView"/> class. /// </summary> /// <param name="viewModel">The data context for this visual.</param> public RomListView(RomListViewModel viewModel) { // TODO: Set up sorting! // TODO: DragDrop! DataContext = viewModel; this.Build(); var treeView = _romListView; treeView.Selection.Mode = Gtk.SelectionMode.Multiple; treeView.HasTooltip = true; treeView.EnableModelDragDest(RomListViewModel.DragDropTargetEntries, Gdk.DragAction.Private); treeView.EnableModelDragSource(Gdk.ModifierType.Button1Mask, RomListViewModel.DragDropSourceEntries, Gdk.DragAction.Copy); var column = new Gtk.TreeViewColumn(); Gtk.CellRenderer cellRenderer = new Gtk.CellRendererPixbuf(); column.PackStart(cellRenderer, true); column.SetCellDataFunc(cellRenderer, (l, c, m, i) => VisualHelpers.CellImageColumnRenderer <ProgramDescriptionViewModel>(l, c, m, i, p => p.RomFileStatusIcon)); column.Sizing = Gtk.TreeViewColumnSizing.Fixed; column.FixedWidth = 20; treeView.AppendColumn(column); column = new Gtk.TreeViewColumn() { Title = RomListViewModel.TitleHeader }; cellRenderer = new Gtk.CellRendererText(); column.PackStart(cellRenderer, true); column.SetCellDataFunc(cellRenderer, (l, c, m, i) => VisualHelpers.CellTextColumnRenderer <ProgramDescriptionViewModel>(l, c, m, i, p => p.Name)); column.Sizing = Gtk.TreeViewColumnSizing.Fixed; column.FixedWidth = Properties.Settings.Default.RomListNameColWidth; column.Resizable = true; treeView.AppendColumn(column); column = new Gtk.TreeViewColumn() { Title = RomListViewModel.CompanyHeader }; cellRenderer = new Gtk.CellRendererText(); column.PackStart(cellRenderer, true); column.SetCellDataFunc(cellRenderer, (l, c, m, i) => VisualHelpers.CellTextColumnRenderer <ProgramDescriptionViewModel>(l, c, m, i, p => p.Vendor)); column.Sizing = Gtk.TreeViewColumnSizing.Fixed; column.FixedWidth = Properties.Settings.Default.RomListVendorColWidth; column.Resizable = true; treeView.AppendColumn(column); column = new Gtk.TreeViewColumn() { Title = RomListViewModel.YearHeader }; cellRenderer = new Gtk.CellRendererText(); column.PackStart(cellRenderer, true); column.SetCellDataFunc(cellRenderer, (l, c, m, i) => VisualHelpers.CellTextColumnRenderer <ProgramDescriptionViewModel>(l, c, m, i, p => p.Year)); column.Sizing = Gtk.TreeViewColumnSizing.Fixed; column.FixedWidth = Properties.Settings.Default.RomListYearColWidth; column.Resizable = true; treeView.AppendColumn(column); column = new Gtk.TreeViewColumn() { Title = RomListViewModel.FeaturesHeader }; cellRenderer = new Gtk.CellRendererPixbuf(); cellRenderer.Xalign = 0; column.PackStart(cellRenderer, true); column.SetCellDataFunc(cellRenderer, (l, c, m, i) => VisualHelpers.CellImageColumnRenderer <ProgramDescriptionViewModel>(l, c, m, i, p => INTV.Shared.Converter.ProgramFeaturesToPixbufConverter.ConvertToPixbuf(p))); column.Sizing = Gtk.TreeViewColumnSizing.Fixed; column.FixedWidth = Properties.Settings.Default.RomListFeaturesColWidth; column.Resizable = true; treeView.AppendColumn(column); column = new Gtk.TreeViewColumn() { Title = RomListViewModel.RomFileHeader }; cellRenderer = new Gtk.CellRendererText(); column.PackStart(cellRenderer, true); column.SetCellDataFunc(cellRenderer, (l, c, m, i) => VisualHelpers.CellTextColumnRenderer <ProgramDescriptionViewModel>(l, c, m, i, p => p.Rom.RomPath)); ////column.Sizing = Gtk.TreeViewColumnSizing.Fixed; ////column.FixedWidth = Properties.Settings.Default.RomListPathColWidth; column.Resizable = true; treeView.AppendColumn(column); treeView.QueryTooltip += HandleQueryTooltip; ////column = new Gtk.TreeViewColumn() { Title = "Manual" }; ////cellRenderer = new Gtk.CellRendererText(); ////column.PackStart(cellRenderer, true); ////column.SetCellDataFunc(cellRenderer, (l,c,m,i) =>VisualHelpers.CellTextColumnRenderer<ProgramDescriptionViewModel>(l,c,m,i, p => p.ManualPath)); ////column.Sizing = Gtk.TreeViewColumnSizing.Fixed; ////column.FixedWidth = Properties.Settings.Default.RomListManualPathColWidth;; ////column.Resizable = true; ////treeView.AppendColumn(column); var romListStore = new Gtk.ListStore(typeof(ProgramDescriptionViewModel)); romListStore.SynchronizeCollection(viewModel.Programs); treeView.Model = romListStore; // Hackish way to get the visibility right. HandleSettingsChanged(Properties.Settings.Default, new System.ComponentModel.PropertyChangedEventArgs(Properties.Settings.ShowRomDetailsSettingName)); Properties.Settings.Default.PropertyChanged += HandleSettingsChanged; viewModel.Programs.CollectionChanged += HandleProgramsChanged; viewModel.Model.ProgramStatusChanged += HandleProgramStatusChanged; treeView.Selection.Changed += HandleSelectionChanged; ViewModel.CurrentSelection.CollectionChanged += HandleViewModelSelectionChanged; }
/// <summary> /// Initializes a new instance of the RomListTableViewDelegate type. /// </summary> /// <param name="programs">Array controller for the program list.</param> /// <param name="viewModel">The data context to use.</param> internal RomListTableViewDelegate(NSArrayController programs, RomListViewModel viewModel) { Programs = programs; ViewModel = viewModel; }