void listBox_SelectDirectory(object sender, EventArgs e) { var listBox = sender as FileList; if (listBox.SelectedDirectory != null) { var subFileList = new FileList(this); subFileList.Initialize(listBox.SelectedDirectory); subFileList.SelectedIndexChanged += listBox_SelectDirectory; ListNavigation.Push(subFileList, subFileList.CurrentDirectory.Name); } else if (listBox.SelectedFile != null) { LoadFile(listBox.SelectedFile); } }
public void LoadFile(string fileName, Stream stream, Format format) { try { Document doc = format.Info.Create(this.Generator); doc.FileName = fileName; //if (doc.Info.CanEdit) // doc.EditMode = true; loadingStream = new BufferedStream(stream, 4096); if (handler != null) { handler.Document.Dispose(); handler.Dispose(); handler = null; } handler = doc.CreateHandler(); handler.PreLoad(loadingStream, format); if (!UsingSplitter) { ListNavigation.Push(handler.ViewerControl, Path.GetFileName(doc.FileName)); /*handler.ViewerControl.Disposed += delegate { * handler.Document.Dispose (); * handler.Dispose (); * this.handler = null; * };*/ } else { ViewerPane.Content = handler.ViewerControl; } handler.Load(loadingStream, format); handler.PostLoad(); } catch (Exception e) { MessageBox.Show(Generator, this, string.Format("Unable to load the selected file ({0})", e.ToString())); Console.WriteLine(e.ToString()); } //viewerPane.ScrollPosition = new Point (0, 0); //viewerPane.UpdateSizes (); }
protected override void OnFirstShow() { base.OnFirstShow(); holdDropBehaviour = new InputHoldBehaviour(InputAction.Drop); holdDropBehaviour.OnTrigger += HoldDropBehaviour_OnTrigger; // Build category list. categoriesDataView = new DataViewList <CategoryData, UIInventoryCategory>(Categories); categoriesDataView.Highlighted += CategoriesDataView_Highlighted; categoriesDataView.Selected += CategoriesDataView_Selected; // Item data list. itemsDataView = new DataViewList <ItemData, UIInventoryItem>(Items); itemsDataView.Highlighted += ItemsDataView_Highlighted; itemsDataView.Removed += ItemsDataView_Removed; // Handles navigation between the Category and Items panel. navigation = gameObject.GetComponent <ListNavigation>(); navigation.Register(categoriesDataView); navigation.Register(itemsDataView); navigation.Focused += Navigation_FocusedChanged; }