Ejemplo n.º 1
0
 private void OSAddPrimaryComponentVisuals(IPrimaryComponent primaryComponent, IEnumerable <ComponentVisual> visuals)
 {
     foreach (var visual in visuals)
     {
         if (visual.UniqueId == RomListView.Id)
         {
             // NOTE: Possibly due to oddness it Stetic in MonoDevelop, or the original author's
             // inexperience w/ GTK... but... If the Stetic designer did not have a visual in
             // the first child, then the automatically generated Build() method simply calls
             // HPaned.Add() -- which, by default, places the Gtk.Notebook into the first
             // slot. As a HACK just put a button in there, which we remove and then replace
             // with the supplied visual.
             // TODO: Get rid of the hack and see if inserting the visual will work instead.
             var placeholder = _mainHPaned.FindChild <Gtk.Widget>(c => c.Name == "_child1");
             _mainHPaned.Remove(placeholder);
             placeholder.Destroy();
             _child1 = null;
             _mainHPaned.Add1(visual.Visual);
             var romListView = visual.Visual.AsType <RomListView>();
             GLib.Idle.Add(() =>
             {
                 var romListTree = visual.Visual.NativeVisual.FindChild <Gtk.TreeView>();
                 romListTree.GrabFocus();
                 return(false);
             });
             var viewModel = romListView.DataContext as RomListViewModel;
             viewModel.CollectionChanged += HandleRomListCollectionChanged;
             viewModel.CurrentSelection.CollectionChanged += HandleRomListSelectionChanged;
             HandleRomListCollectionChanged(viewModel, null);
         }
         else if (visual.UniqueId == MenuLayoutView.Id)
         {
             var menuLayout = visual.Visual.AsType <MenuLayoutView>();
             var viewModel  = menuLayout.DataContext as LtoFlashViewModel;
             var initializePropertyValues = new[]
             {
                 LtoFlashViewModel.ActiveLtoFlashDevicePropertyName,
                 "LtoDeviceConnectedImage",
             };
             foreach (var property in initializePropertyValues)
             {
                 HandleLtoFlashPropertyChanged(viewModel, new PropertyChangedEventArgs(property));
             }
             _layoutsNotebook.RemovePage(0); // this falls apart once >1 page is involved
             var menuLayoutLabel = new Gtk.Label(visual.DisplayName);
             _layoutsNotebook.AppendPage(visual.Visual, menuLayoutLabel);
             viewModel.PropertyChanged += HandleLtoFlashPropertyChanged;
         }
     }
 }
Ejemplo n.º 2
0
 private void OSAddPrimaryComponentVisuals(IPrimaryComponent primaryComponent, IEnumerable <ComponentVisual> visuals)
 {
     // TODO: OSAddPrimaryComponentVisuals is not yet implemented.
 }
Ejemplo n.º 3
0
 /// <inheritdoc/>
 public void AddPrimaryComponentVisuals(IPrimaryComponent primaryComponent, IEnumerable <ComponentVisual> visuals)
 {
     OSAddPrimaryComponentVisuals(primaryComponent, visuals);
 }