private void ListView_MouseDoubleClick(object sender, MouseButtonEventArgs e) { //InstrumentHierarchyViewModel item = sender as InstrumentHierarchyViewModel; ExploreHirachyInstrumentVMWrapper item = ExplorerListView_.SelectedItem as ExploreHirachyInstrumentVMWrapper; if (item != null) { LayoutDocument layoutDoc = new LayoutDocument(); //int count = this.Parent.ChildrenCount; //LayoutDocumentPane pane = new LayoutDocumentPane(); Grid grid = new Grid(); grid.Children.Add(item.view()); layoutDoc.Content = grid; layoutDoc.Title = item.ProductName_; mainWindow_.DocumentPane_.Children.Add(layoutDoc); OutputLogViewModel.addResult(new MessageOutput(item.ProductName_ + " is loaded")); } //MainWindow.AddCtrlOnMainWindow(item.View_); }
public HaloScreenshot(string tempImageLocation, LayoutDocument tabItem) { InitializeComponent(); // Convert DDS to BitmapImage _bitmapImage = DDSConversion.Deswizzle(tempImageLocation); // DateTime Creation var date = DateTime.Now; _datetime_long = date.ToString("yyyy-MM-dd,hh-mm-ss"); _datetime_shrt = date.ToString("hh:mm.ss"); // Set Tab Header tabItem.Title = "Screenshot {" + _datetime_shrt + "}"; // Set Image Name lblImageName.Text = _datetime_long + ".png"; // Set Image imageScreenshot.Source = _bitmapImage; // Should I save the image? if (!Settings.XDKAutoSave) return; if (!Directory.Exists(Settings.XDKScreenshotPath)) Directory.CreateDirectory(Settings.XDKScreenshotPath); var filePath = Settings.XDKScreenshotPath + "\\" + _datetime_long + ".png"; SaveImage(filePath); }
/// <summary> /// New Instance of the Halo Map Location /// </summary> /// <param name="cacheLocation"></param> /// <param name="tab"></param> /// <param name="tagSorting"> </param> public HaloMap(string cacheLocation, LayoutDocument tab, Settings.TagSort tagSorting) { InitializeComponent(); AddHandler(CloseableTabItem.CloseTabEvent, new RoutedEventHandler(CloseTab)); // Setup Context Menus InitalizeContextMenus(); _tab = tab; _tagSorting = tagSorting; _cacheLocation = cacheLocation; // Update dockpanel location UpdateDockPanelLocation(); // Show UI Pending Stuff doingAction.Visibility = Visibility.Visible; tabScripts.Visibility = Visibility.Collapsed; // Read Settings cbShowEmptyTags.IsChecked = App.AssemblyStorage.AssemblySettings.HalomapShowEmptyClasses; cbShowBookmarkedTagsOnly.IsChecked = App.AssemblyStorage.AssemblySettings.HalomapOnlyShowBookmarkedTags; cbTabOpenMode.SelectedIndex = (int) App.AssemblyStorage.AssemblySettings.HalomapTagOpenMode; App.AssemblyStorage.AssemblySettings.PropertyChanged += SettingsChanged; var initalLoadBackgroundWorker = new BackgroundWorker(); initalLoadBackgroundWorker.DoWork += initalLoadBackgroundWorker_DoWork; initalLoadBackgroundWorker.RunWorkerCompleted += BackgroundWorker_RunWorkerCompleted; initalLoadBackgroundWorker.RunWorkerAsync(); }
public override LayoutDocument documentView() { LayoutDocument layoutDoc = new LayoutDocument(); //layoutDoc.Content = StepDownInstViewModel.stepDownInstView(); return layoutDoc; }
void document_IsActiveChanged(object sender, EventArgs e) { var doc = sender as LayoutDocument; if (doc.IsActive) { LastActiveDocument = doc; } }
private void Button_Click(object sender, RoutedEventArgs e) { var firstDocumentPane = dockManager.Layout.Descendents().OfType<LayoutDocumentPane>().FirstOrDefault(); if (firstDocumentPane != null) { var doc = new LayoutDocument {Title = "Test1"}; doc.Content = new EditView(); firstDocumentPane.Children.Add(doc); } }
public HaloInfo(string infoLocation, LayoutDocument tab) { InitializeComponent(); _blfLocation = infoLocation; var fi = new FileInfo(_blfLocation); tab.Title = fi.Name; lblBLFname.Text = fi.Name; var thrd = new Thread(LoadMapInfo); thrd.SetApartmentState(ApartmentState.STA); thrd.Start(); }
public HaloImage(string imageLocation, LayoutDocument tab) { InitializeComponent(); _blfLocation = imageLocation; var fi = new FileInfo(_blfLocation); tab.Title = fi.Name; lblBLFname.Text = fi.Name; var thrd = new Thread(loadBLF); thrd.Start(); }
private void OpenDocumentRequestHandler(object data) { var filename = data.ToString(); var firstDocumentPane = dockManager.Layout.Descendents().OfType<LayoutDocumentPane>().FirstOrDefault(); if (firstDocumentPane == null) return; var doc = new LayoutDocument { Title = filename }; var ev = new EditView(); ev.OpenFile(filename); doc.Content = ev; firstDocumentPane.Children.Add(doc); }
void CreateDocumentLayoutItem(LayoutDocument contentToAttach) { if (_layoutItems.Any(item => item.LayoutElement == contentToAttach)) return; var layoutItem = new LayoutDocumentItem(); layoutItem.Attach(contentToAttach); ApplyStyleToLayoutItem(layoutItem); _layoutItems.Add(layoutItem); if (contentToAttach != null && contentToAttach.Content != null && contentToAttach.Content is UIElement) { InternalAddLogicalChild(contentToAttach.Content); } }
internal void _ExecuteCloseCommand(LayoutDocument document) { if (DocumentClosing != null) { var evargs = new DocumentClosingEventArgs(document); DocumentClosing(this, evargs); if (evargs.Cancel) return; } if (!document.TestCanClose()) return; document.Close(); if (DocumentClosed != null) { var evargs = new DocumentClosedEventArgs(document); DocumentClosed(this, evargs); } }
void AttachDocumentsSource(LayoutRoot layout, IEnumerable documentsSource) { if (documentsSource == null) return; if (layout == null) return; //if (layout.Descendents().OfType<LayoutDocument>().Any()) // throw new InvalidOperationException("Unable to set the DocumentsSource property if LayoutDocument objects are already present in the model"); var documentsImported = layout.Descendents().OfType<LayoutDocument>().Select(d => d.Content).ToArray(); var documents = documentsSource as IEnumerable; var listOfDocumentsToImport = new List<object>(documents.OfType<object>()); foreach (var document in listOfDocumentsToImport.ToArray()) { if (documentsImported.Contains(document)) listOfDocumentsToImport.Remove(document); } LayoutDocumentPane documentPane = null; if (layout.LastFocusedDocument != null) { documentPane = layout.LastFocusedDocument.Parent as LayoutDocumentPane; } if (documentPane == null) { documentPane = layout.Descendents().OfType<LayoutDocumentPane>().FirstOrDefault(); } //if (documentPane == null) // throw new InvalidOperationException("Layout must contains at least one LayoutDocumentPane in order to host documents"); _suspendLayoutItemCreation = true; foreach (var documentContentToImport in listOfDocumentsToImport) { //documentPane.Children.Add(new LayoutDocument() { Content = documentToImport }); var documentToImport = new LayoutDocument() { Content = documentContentToImport }; bool added = false; if (LayoutUpdateStrategy != null) { added = LayoutUpdateStrategy.BeforeInsertDocument(layout, documentToImport, documentPane); } if (!added) { if (documentPane == null) throw new InvalidOperationException("Layout must contains at least one LayoutDocumentPane in order to host documents"); documentPane.Children.Add(documentToImport); added = true; } if (LayoutUpdateStrategy != null) LayoutUpdateStrategy.AfterInsertDocument(layout, documentToImport); CreateDocumentLayoutItem(documentToImport); } _suspendLayoutItemCreation = true; var documentsSourceAsNotifier = documentsSource as INotifyCollectionChanged; if (documentsSourceAsNotifier != null) documentsSourceAsNotifier.CollectionChanged += new NotifyCollectionChangedEventHandler(documentsSourceElementsChanged); }
private void CreateNewFile() { var editorDocument = new LayoutDocument {Title = "Linear Program Problem " + _documentCounter}; editorDocument.Content = new TextEditorControl(editorDocument.Title, _documentCounter); editorDocument.Closing += EditorDocumentClosing; CenterDockPane.Children.Add(editorDocument); _documentCounter++; _parserTimer.Start(); TBtnAutoParse.IsChecked = true; }
private void OpenFileClick(object sender, RoutedEventArgs e) { var dlg = new OpenFileDialog {CheckFileExists = true, Filter = "{LP Solver Files (*.lps)|*.lps", Multiselect = false}; if ((bool) dlg.ShowDialog()) { try { var strReader = new StreamReader(dlg.FileName); string data = strReader.ReadToEnd(); strReader.Close(); var editorDocument = new LayoutDocument { Title = dlg.FileName.Substring( dlg.FileName.LastIndexOf("\\", StringComparison.Ordinal) + 1) }; editorDocument.Content = new TextEditorControl(editorDocument.Title, _documentCounter, data) {FileUrl = dlg.FileName}; editorDocument.Closing += EditorDocumentClosing; CenterDockPane.Children.Add(editorDocument); _documentCounter++; _parserTimer.Start(); TBtnAutoParse.IsChecked = true; } catch (Exception exp) { statusBarControl.State = new LPSolverState("Could not Load file :" + exp.Message, EnumEditorStates.Error); } } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.toolsGroup = ((Fluent.RibbonContextualTabGroup)(target)); return; case 2: this.buttonLoad = ((Fluent.Button)(target)); #line 20 "..\..\..\MainWindow.xaml" this.buttonLoad.Click += new System.Windows.RoutedEventHandler(this.bookLoadButton_Click); #line default #line hidden return; case 3: this.buttonSetting = ((Fluent.Button)(target)); #line 22 "..\..\..\MainWindow.xaml" this.buttonSetting.Click += new System.Windows.RoutedEventHandler(this.buttonSetting_Click); #line default #line hidden return; case 4: this.explorerLoad = ((Fluent.Button)(target)); #line 23 "..\..\..\MainWindow.xaml" this.explorerLoad.Click += new System.Windows.RoutedEventHandler(this.explorerLoad_Click); #line default #line hidden return; case 5: this.AddNewInstBtn_ = ((Fluent.Button)(target)); #line 24 "..\..\..\MainWindow.xaml" this.AddNewInstBtn_.Click += new System.Windows.RoutedEventHandler(this.AddNewInstBtn__Click); #line default #line hidden return; case 6: this.BatchControlBtn_ = ((Fluent.Button)(target)); #line 25 "..\..\..\MainWindow.xaml" this.BatchControlBtn_.Click += new System.Windows.RoutedEventHandler(this.BatchControlBtn_Click); #line default #line hidden return; case 7: this.MROPositionLoadBtn_ = ((Fluent.Button)(target)); #line 26 "..\..\..\MainWindow.xaml" this.MROPositionLoadBtn_.Click += new System.Windows.RoutedEventHandler(this.MROPositionLoadBtn_Click); #line default #line hidden return; case 8: this.DeltaHedgeMonitorBtn_ = ((Fluent.Button)(target)); #line 27 "..\..\..\MainWindow.xaml" this.DeltaHedgeMonitorBtn_.Click += new System.Windows.RoutedEventHandler(this.DeltaHedgeMonitorBtn_Click); #line default #line hidden return; case 9: this.ResualtDocking = ((AvalonDock.DockingManager)(target)); return; case 10: this.DocumentPaneGroup_ = ((AvalonDock.Layout.LayoutDocumentPaneGroup)(target)); return; case 11: this.DocumentPane_ = ((AvalonDock.Layout.LayoutDocumentPane)(target)); return; case 12: this.StartDocument_ = ((AvalonDock.Layout.LayoutDocument)(target)); return; case 13: this.ouputPane_ = ((AvalonDock.Layout.LayoutDocumentPane)(target)); return; case 14: this.ExplorerPaneGroup = ((AvalonDock.Layout.LayoutAnchorablePaneGroup)(target)); return; case 15: this.ExplorerPortfolio_ = ((AvalonDock.Layout.LayoutAnchorablePane)(target)); return; } this._contentLoaded = true; }
public void AddToLayoutDocumentOnMainWindow(FrameworkElement ctrl, RiskMonitor.Activate activate = RiskMonitor.Activate.Hide ) { LayoutDocument layoutDoc = new LayoutDocument(); layoutDoc.Content = ctrl; this.DocumentPane_.Children.Add(layoutDoc); }
private void DeltaHedgeMonitorBtn_Click(object sender, RoutedEventArgs e) { LayoutDocument layoutDoc = new LayoutDocument(); DeltaHedgeMonitorView ctrl = new DeltaHedgeMonitorView(); DeltaHedgeMonitorViewModel viewModel = new DeltaHedgeMonitorViewModel(); ctrl.ViewModel_ = viewModel; layoutDoc.Content = ctrl; layoutDoc.Title = "DeltaHedge"; this.DocumentPane_.Children.Add(layoutDoc); }
/// <summary> /// Add a new MapInfo Editor Container /// </summary> /// <param name="infooLocation">Path to the MapInfo file</param> public void AddInfooTabModule(string infooLocation) { // Check Map isn't already open foreach (var tab in documentManager.Children.Where(tab => tab.ContentId == infooLocation)) { documentManager.SelectedContentIndex = documentManager.IndexOfChild(tab); return; } var newMapImageTab = new LayoutDocument { ContentId = infooLocation, Title = "Image", ToolTip = infooLocation }; newMapImageTab.Content = new HaloInfo(infooLocation, newMapImageTab); documentManager.Children.Add(newMapImageTab); documentManager.SelectedContentIndex = documentManager.IndexOfChild(newMapImageTab); }
void documentsSourceElementsChanged(object sender, NotifyCollectionChangedEventArgs e) { if (Layout == null) return; //When deserializing documents are created automatically by the deserializer if (SuspendDocumentsSourceBinding) return; //handle remove if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove || e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Replace) { if (e.OldItems != null) { var documentsToRemove = Layout.Descendents().OfType<LayoutDocument>().Where(d => e.OldItems.Contains(d.Content)).ToArray(); foreach (var documentToRemove in documentsToRemove) { (documentToRemove.Parent as ILayoutContainer).RemoveChild( documentToRemove); } } } //handle add if (e.NewItems != null && (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add || e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Replace)) { if (e.NewItems != null) { LayoutDocumentPane documentPane = null; if (Layout.LastFocusedDocument != null) { documentPane = Layout.LastFocusedDocument.Parent as LayoutDocumentPane; } if (documentPane == null) { documentPane = Layout.Descendents().OfType<LayoutDocumentPane>().FirstOrDefault(); } //if (documentPane == null) // throw new InvalidOperationException("Layout must contains at least one LayoutDocumentPane in order to host documents"); _suspendLayoutItemCreation = true; foreach (var documentContentToImport in e.NewItems) { var documentToImport = new LayoutDocument() { Content = documentContentToImport }; bool added = false; if (LayoutUpdateStrategy != null) { added = LayoutUpdateStrategy.BeforeInsertDocument(Layout, documentToImport, documentPane); } if (!added) { if (documentPane == null) throw new InvalidOperationException("Layout must contains at least one LayoutDocumentPane in order to host documents"); documentPane.Children.Add(documentToImport); added = true; } if (LayoutUpdateStrategy != null) { LayoutUpdateStrategy.AfterInsertDocument(Layout, documentToImport); } var root = documentToImport.Root; if (root != null && root.Manager == this) { CreateDocumentLayoutItem(documentToImport); } } _suspendLayoutItemCreation = false; } } if (e.Action == NotifyCollectionChangedAction.Reset) { //NOTE: I'm going to clear every document present in layout but //some documents may have been added directly to the layout, for now I clear them too var documentsToRemove = Layout.Descendents().OfType<LayoutDocument>().ToArray(); foreach (var documentToRemove in documentsToRemove) { (documentToRemove.Parent as ILayoutContainer).RemoveChild( documentToRemove); } } if (Layout != null) { Layout.CollectGarbage(); } }
/// <summary> /// Add a new Blam Cache Editor Container /// </summary> /// <param name="cacheLocation">Path to the Blam Cache File</param> public void AddCacheTabModule(string cacheLocation) { // Check Map isn't already open foreach (var tab in documentManager.Children.Where(tab => tab.ContentId == cacheLocation)) { documentManager.SelectedContentIndex = documentManager.IndexOfChild(tab); return; } var newCacheTab = new LayoutDocument { ContentId = cacheLocation, Title = "", ToolTip = cacheLocation }; newCacheTab.Content = new HaloMap(cacheLocation, newCacheTab, Settings.halomapTagSort); documentManager.Children.Add(newCacheTab); documentManager.SelectedContentIndex = documentManager.IndexOfChild(newCacheTab); }
public DocumentClosingEventArgs(LayoutDocument document) { Document = document; }
public void AddTabModule(TabGenre tabG, bool singleInstance = true) { var tab = new LayoutDocument(); switch (tabG) { case TabGenre.StartPage: tab.Title = "Start Page"; tab.Content = new StartPage(); break; case TabGenre.Welcome: tab.Title = "Welcome"; tab.Content = new WelcomePage(); break; case TabGenre.Settings: tab.Title = "Settings"; tab.Content = new SettingsPage(); break; } if (singleInstance) foreach (LayoutContent tabb in documentManager.Children.Where(tabb => tabb.Title == tab.Title)) { documentManager.SelectedContentIndex = documentManager.IndexOfChild(tabb); return; } documentManager.Children.Add(tab); documentManager.SelectedContentIndex = documentManager.IndexOfChild(tab); }
private void AddTwoDocuments_click(object sender, RoutedEventArgs e) { var firstDocumentPane = dockManager.Layout.Descendents().OfType<LayoutDocumentPane>().FirstOrDefault(); if (firstDocumentPane != null) { LayoutDocument doc = new LayoutDocument(); doc.Title = "Test1"; firstDocumentPane.Children.Add(doc); LayoutDocument doc2 = new LayoutDocument(); doc2.Title = "Test2"; firstDocumentPane.Children.Add(doc2); } var leftAnchorGroup = dockManager.Layout.LeftSide.Children.FirstOrDefault(); if (leftAnchorGroup == null) { leftAnchorGroup = new LayoutAnchorGroup(); dockManager.Layout.LeftSide.Children.Add(leftAnchorGroup); } leftAnchorGroup.Children.Add(new LayoutAnchorable() { Title = "New Anchorable" }); }
public bool BeforeInsertDocument(LayoutRoot layout, LayoutDocument anchorableToShow, ILayoutContainer destinationContainer) { return false; }
public void AddToLayoutDocumentOnMainWindow(LayoutDocument layoutDoc, RiskMonitor.Activate activate = RiskMonitor.Activate.Hide ) { this.DocumentPane_.Children.Add(layoutDoc); }
/// <summary> /// Add a new XBox Screenshot Editor Container /// </summary> /// <param name="tempImageLocation">Path to the temporary location of the image</param> public void AddScrenTabModule(string tempImageLocation) { var newScreenshotTab = new LayoutDocument { ContentId = tempImageLocation, Title = "Screenshot", ToolTip = tempImageLocation }; newScreenshotTab.Content = new HaloScreenshot(tempImageLocation, newScreenshotTab); documentManager.Children.Add(newScreenshotTab); documentManager.SelectedContentIndex = documentManager.IndexOfChild(newScreenshotTab); }
private void BatchControlBtn_Click(object sender, RoutedEventArgs e) { LayoutDocument layoutDoc = new LayoutDocument(); BatchControlView ctrl = new BatchControlView(); BatchControlViewModel viewModel = new BatchControlViewModel(this.viewModel_.BookInfoVM_); //viewModel.InstHierarchyList_ = this.instExView_.instExViewModel_.InstHierarchyList_; ctrl.ViewModel_ = viewModel; layoutDoc.Content = ctrl; layoutDoc.Title = "BatchControl"; this.DocumentPane_.Children.Add(layoutDoc); }
public void AddTabModule(TabGenre tabG, bool singleInstance = true) { var tab = new LayoutDocument(); switch (tabG) { case TabGenre.StartPage: tab.Title = "Start Page"; tab.Content = new StartPage(); break; case TabGenre.Welcome: tab.Title = "Welcome"; tab.Content = new WelcomePage(); break; case TabGenre.Settings: tab.Title = "Settings"; tab.Content = new SettingsPage(); break; case TabGenre.NetworkPoking: tab.Title = "Network Poking"; tab.Content = new NetworkGrouping(); break; case TabGenre.PluginGenerator: tab.Title = "Plugin Generator"; tab.Content = new HaloPluginGenerator(); break; case TabGenre.PluginConverter: tab.Title = "Plugin Converter"; tab.Content = new HaloPluginConverter(); break; case TabGenre.MemoryManager: tab.Title = "Memory Manager"; tab.Content = new MemoryManager(); break; case TabGenre.VoxelConverter: tab.Title = "Voxel Converter"; tab.Content = new VoxelConverter(); break; case TabGenre.PostGenerator: tab.Title = "Post Generator"; tab.Content = new PostGenerator(); break; } if (singleInstance) foreach (var tabb in documentManager.Children.Where(tabb => tabb.Title == tab.Title)) { documentManager.SelectedContentIndex = documentManager.IndexOfChild(tabb); return; } documentManager.Children.Add(tab); documentManager.SelectedContentIndex = documentManager.IndexOfChild(tab); }
/// <summary> /// Add a new Patch Control /// </summary> /// <param name="patchLocation">Path to the Patch file</param> public void AddPatchTabModule(string patchLocation = null) { var newPatchTab = new LayoutDocument { Title = "Patcher", Content = (patchLocation != null) ? new PatchControl(patchLocation) : new PatchControl() }; documentManager.Children.Add(newPatchTab); documentManager.SelectedContentIndex = documentManager.IndexOfChild(newPatchTab); }
public void ExternalTabClose(LayoutDocument tab) { documentManager.Children.Remove(tab); if (documentManager.Children.Count > 0) documentManager.SelectedContentIndex = documentManager.Children.Count - 1; }