public SaveAsReturnInfo(string newName, string fileNameAndPath, LibraryProvider destinationLibraryProvider) { this.destinationLibraryProvider = destinationLibraryProvider; this.newName = newName; this.fileNameAndPath = fileNameAndPath; }
protected override IEnumerable <ITestCommand> EnumerateTestCommands(IMethodInfo method) { return(LibraryProvider.GetAdapters(method.Class.Type.Assembly) .Select(adapter => new FeatureTestCommand(method, adapter))); }
public LibrarySelectorRowItem(PrintItemCollection collection, int collectionIndex, LibrarySelectorWidget libraryDataView, LibraryProvider parentProvider, GuiWidget thumbnailWidget, string openButtonText) { this.thumbnailWidget = thumbnailWidget; this.libraryDataView = libraryDataView; this.CollectionIndex = collectionIndex; this.parentProvider = parentProvider; this.printItemCollection = collection; this.ItemName = printItemCollection.Name; this.Name = this.ItemName + " Row Item Collection"; CreateGuiElements(openButtonText); }
private void EnableSaveAsButtonOnChangedLibraryProvider(LibraryProvider arg1, LibraryProvider arg2) { // Once we have navigated to any provider enable the ability to click the save as button. saveAsButton.Enabled = true; }
public LibraryRowItemCollection(PrintItemCollection collection, LibraryProvider currentProvider, int collectionIndex, LibraryDataView libraryDataView, LibraryProvider parentProvider, GuiWidget thumbnailWidget) : base(libraryDataView, thumbnailWidget) { this.currentProvider = currentProvider; this.CollectionIndex = collectionIndex; this.parentProvider = parentProvider; this.printItemCollection = collection; this.ItemName = printItemCollection.Name; this.Name = this.ItemName + " Row Item Collection"; CreateGuiElements(); }
public void SetCurrentLibraryProvider(LibraryProvider libraryProvider) { this.CurrentLibraryProvider = libraryProvider; }
public void SetBreadCrumbs(LibraryProvider previousLibraryProvider, LibraryProvider currentLibraryProvider) { LibraryProvider displayingProvider = currentLibraryProvider; this.CloseAllChildren(); List <LibraryProvider> parentProviderList = new List <LibraryProvider>(); while (currentLibraryProvider != null) { parentProviderList.Add(currentLibraryProvider); currentLibraryProvider = currentLibraryProvider.ParentLibraryProvider; } bool haveFilterRunning = !string.IsNullOrEmpty(displayingProvider.KeywordFilter); bool first = true; for (int i = parentProviderList.Count - 1; i >= 0; i--) { LibraryProvider parentLibraryProvider = parentProviderList[i]; if (!first) { GuiWidget separator = new TextWidget(">", textColor: ActiveTheme.Instance.PrimaryTextColor); separator.VAnchor = VAnchor.ParentCenter; separator.Margin = new BorderDouble(0); this.AddChild(separator); } Button gotoProviderButton = navigationButtonFactory.Generate(parentLibraryProvider.Name); gotoProviderButton.Name = "Bread Crumb Button " + parentLibraryProvider.Name; if (first) { gotoProviderButton.Margin = new BorderDouble(0, 0, 3, 0); } else { gotoProviderButton.Margin = new BorderDouble(3, 0); } gotoProviderButton.Click += (sender2, e2) => { UiThread.RunOnIdle(() => { SwitchToLibraryProvider(parentLibraryProvider); }); }; this.AddChild(gotoProviderButton); first = false; } if (haveFilterRunning) { GuiWidget separator = new TextWidget(">", textColor: ActiveTheme.Instance.PrimaryTextColor); separator.VAnchor = VAnchor.ParentCenter; separator.Margin = new BorderDouble(0); this.AddChild(separator); Button searchResultsButton = null; if (UserSettings.Instance.IsTouchScreen) { searchResultsButton = navigationButtonFactory.Generate("Search Results".Localize(), "icon_search_32x32.png"); } else { searchResultsButton = navigationButtonFactory.Generate("Search Results".Localize(), "icon_search_24x24.png"); } searchResultsButton.Name = "Bread Crumb Button " + "Search Results"; searchResultsButton.Margin = new BorderDouble(3, 0); this.AddChild(searchResultsButton); } // while all the buttons don't fit in the control if (this.Parent != null && this.Width > 0 && this.Children.Count > 4 && this.GetChildrenBoundsIncludingMargins().Width > (this.Width - 20)) { // lets take out the > and put in a ... this.RemoveChild(1); GuiWidget separator = new TextWidget("...", textColor: ActiveTheme.Instance.PrimaryTextColor); separator.VAnchor = VAnchor.ParentCenter; separator.Margin = new BorderDouble(3, 0); this.AddChild(separator, 1); while (this.GetChildrenBoundsIncludingMargins().Width > this.Width - 20 && this.Children.Count > 4) { this.RemoveChild(3); this.RemoveChild(2); } } }
public LibraryRowItemCollection(PrintItemCollection collection, LibraryProvider currentProvider, int collectionIndex, LibraryDataView libraryDataView, LibraryProvider parentProvider, GuiWidget thumbnailWidget, string openButtonText) : base(libraryDataView, thumbnailWidget) { this.openButtonText = openButtonText; this.currentProvider = currentProvider; this.CollectionIndex = collectionIndex; this.parentProvider = parentProvider; this.printItemCollection = collection; this.ItemName = printItemCollection.Name; this.Name = this.ItemName + " Row Item Collection"; if (collection.Key == LibraryRowItem.LoadingPlaceholderToken) { this.EnableSlideInActions = false; this.IsViewHelperItem = true; } CreateGuiElements(); }
public void LibraryProviderFileSystem_NavigationWorking() { StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", "..", "StaticData")); string downloadsDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads"); string testLibraryDirectory = Path.Combine(downloadsDirectory, "LibraryProviderFileSystemTest"); if (Directory.Exists(testLibraryDirectory)) { Directory.Delete(testLibraryDirectory, true); } Directory.CreateDirectory(testLibraryDirectory); LibraryProviderFileSystem testProvider = new LibraryProviderFileSystem(testLibraryDirectory, "TestPath", null, null); testProvider.DataReloaded += (sender, e) => { dataReloaded = true; }; Assert.IsTrue(testProvider.CollectionCount == 0, "Start with a new database for these tests."); Assert.IsTrue(testProvider.ItemCount == 0, "Start with a new database for these tests."); // create a collection and make sure it is on disk dataReloaded = false; // it has been loaded for the default set of parts string collectionName = "Collection1"; string createdDirectory = Path.Combine(testLibraryDirectory, collectionName); Assert.IsTrue(!Directory.Exists(createdDirectory)); Assert.IsTrue(dataReloaded == false); testProvider.AddCollectionToLibrary(collectionName); Thread.Sleep(500); // wait for the add to finish Assert.IsTrue(testProvider.CollectionCount == 1); Assert.IsTrue(dataReloaded == true); Assert.IsTrue(Directory.Exists(createdDirectory)); // add an item works correctly LibraryProvider subProvider = testProvider.GetProviderForCollection(testProvider.GetCollectionItem(0)); subProvider.DataReloaded += (sender, e) => { dataReloaded = true; }; dataReloaded = false; //itemAdded = false; string subPathAndFile = Path.Combine(createdDirectory, meshFileName); Assert.IsTrue(!File.Exists(subPathAndFile)); Assert.IsTrue(dataReloaded == false); //Assert.IsTrue(itemAdded == false); // WIP: saving the name incorectly for this location (does not need to be changed). subProvider.AddFilesToLibrary(new string[] { meshPathAndFileName }); Thread.Sleep(3000); // wait for the add to finish PrintItemWrapper itemAtRoot = subProvider.GetPrintItemWrapperAsync(0).Result; Assert.IsTrue(subProvider.ItemCount == 1); Assert.IsTrue(dataReloaded == true); //Assert.IsTrue(itemAdded == true); Assert.IsTrue(File.Exists(subPathAndFile)); // make sure the provider locator is correct // remove item works dataReloaded = false; Assert.IsTrue(dataReloaded == false); subProvider.RemoveItem(0); Thread.Sleep(500); // wait for the remove to finish Assert.IsTrue(dataReloaded == true); Assert.IsTrue(!File.Exists(subPathAndFile)); // remove collection gets rid of it dataReloaded = false; Assert.IsTrue(dataReloaded == false); testProvider.RemoveCollection(0); Thread.Sleep(500); // wait for the remove to finish Assert.IsTrue(dataReloaded == true); Assert.IsTrue(testProvider.CollectionCount == 0); Assert.IsTrue(!Directory.Exists(createdDirectory)); if (Directory.Exists(testLibraryDirectory)) { Directory.Delete(testLibraryDirectory, true); } }
public FolderBreadCrumbWidget(Action <LibraryProvider> SwitchToLibraryProvider, LibraryProvider currentLibraryProvider) { this.Name = "FolderBreadCrumbWidget"; this.SwitchToLibraryProvider = SwitchToLibraryProvider; UiThread.RunOnIdle(() => SetBreadCrumbs(null, currentLibraryProvider)); navigationButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor; navigationButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor; navigationButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor; navigationButtonFactory.disabledTextColor = ActiveTheme.Instance.PrimaryTextColor; navigationButtonFactory.disabledFillColor = navigationButtonFactory.normalFillColor; navigationButtonFactory.Margin = new BorderDouble(10, 0); navigationButtonFactory.borderWidth = 0; HAnchor = HAnchor.ParentLeftRight; }
private void ClearSearchWidget(LibraryProvider previousLibraryProvider, LibraryProvider currentLibraryProvider) { previousLibraryProvider.KeywordFilter = ""; searchInput.Text = currentLibraryProvider.KeywordFilter; breadCrumbWidget.SetBreadCrumbs(null, currentPrintLibraryWidget.libraryDataView.CurrentLibraryProvider); }
public void SetCurrentLibraryProvider(LibraryProvider libraryProvider) { this.CurrentLibraryProvider = libraryProvider; UiThread.RunOnIdle(RebuildView); }
public void SetBreadCrumbs(LibraryProvider previousLibraryProvider, LibraryProvider currentLibraryProvider) { navigationButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor; navigationButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor; navigationButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor; navigationButtonFactory.disabledTextColor = ActiveTheme.Instance.PrimaryTextColor; navigationButtonFactory.Margin = new BorderDouble(10, 0); this.CloseAndRemoveAllChildren(); List <LibraryProvider> parentProviderList = new List <LibraryProvider>(); while (currentLibraryProvider != null) { parentProviderList.Add(currentLibraryProvider); currentLibraryProvider = currentLibraryProvider.ParentLibraryProvider; } bool first = true; for (int i = parentProviderList.Count - 1; i >= 0; i--) { LibraryProvider parentLibraryProvider = parentProviderList[i]; if (!first) { GuiWidget separator = new TextWidget(">", textColor: ActiveTheme.Instance.PrimaryTextColor); separator.VAnchor = VAnchor.ParentCenter; separator.Margin = new BorderDouble(0); this.AddChild(separator); } Button gotoProviderButton = navigationButtonFactory.Generate(parentLibraryProvider.Name); gotoProviderButton.Margin = new BorderDouble(3, 0); gotoProviderButton.Click += (sender2, e2) => { UiThread.RunOnIdle(() => { SwitchToLibraryProvider(parentLibraryProvider); }); }; this.AddChild(gotoProviderButton); first = false; } // while all the buttons don't fit in the control if (this.Parent.Width > 0 && this.Children.Count > 4 && this.GetChildrenBoundsIncludingMargins().Width > this.Parent.Width) { // lets take out the > and put in a ... this.RemoveChild(1); GuiWidget separator = new TextWidget("...", textColor: ActiveTheme.Instance.PrimaryTextColor); separator.VAnchor = VAnchor.ParentCenter; separator.Margin = new BorderDouble(3, 0); this.AddChild(separator, 1); while (this.GetChildrenBoundsIncludingMargins().Width > this.Parent.Width && this.Children.Count > 4) { this.RemoveChild(3); this.RemoveChild(2); } } }
public FolderBreadCrumbWidget(Action <LibraryProvider> SwitchToLibraryProvider, LibraryProvider currentLibraryProvider) { this.SwitchToLibraryProvider = SwitchToLibraryProvider; UiThread.RunOnIdle(() => SetBreadCrumbs(null, currentLibraryProvider)); }
public LibraryDataViewEventArgs(LibraryProvider libraryProvider) { this.LibraryProvider = libraryProvider; }