private void NewNameCommand_Executed(object sender, ExecutedRoutedEventArgs e) { Button Clicked = (Button)e.Parameter; if (Clicked.Name == "OK") { if (NewNameTB.Text.Length != 0) { if (NEWhelper()) { NewText = NewNameTB.Text; NEWchanger(); if (IsItBeingSaved) { AppMW.thisStructureName = NewText; } else { AppMW.CurrentlyChosenDir.Description.Name = NewText; DirManagement.GetDefaultInstance().AutoGenerateDirFullName((IEditableDirWithChildrenAndParent)AppMW.CurrentlyChosenDir); DirManagement.GetDefaultInstance().AutoGenerateChildrenFullName(AppMW.CurrentlyChosenDir); AppMW.sorteritno.ResetTree(AppMW.ResTree, AppMW.ResetHighlight, AppMW.Seed, AppMW.drzewo, "MW"); AddMemento(); } } } } this.Close(); }
static void Main(string[] args) { Console.Beep(); IEditableDirWithChildren main = DirManagement.GetDefaultInstance().GetFolderAsNewMainDir(@"C:\Users\Klakier\Desktop\kociFolder\koci"); DirManagement.GetDefaultInstance().ChangeCreatedDirSystemValue("kotek jest tutaj", main, @"C:\Users\Klakier\Downloads\Hopstarter-Soft-Scraps-Folder-Generic-Green.ico"); }
private void ApplyChangesCAW_Executed(object sender, ExecutedRoutedEventArgs e) { if (AppMW.sorteritno.GetDirCount(NewSeed) + AppMW.sorteritno.dir_counter < AppMW.sorteritno.dir_count_max) { CurrentlyChosenCAW.Background = Brushes.LightGray; CurrentlyChosenDir = (IEditableDirWithChildren)CurrentlyChosenCAW.Tag; CurrentlyChosenDir.IsMarked = false; CurrentlyChosenCAW = null; CurrentlyChosenDir = null; Button ThisButton = (Button)e.Parameter; SaveAndReadElementInBinaryFile.GetDefaultInstance() .WriteToBinaryFile <IEditableDirWithChildren>(@"..\..\..\TemporaryFiles\tempFile~CopyCAW", NewSeed); List <IEditableDirWithChildrenAndParent> children = SaveAndReadElementInBinaryFile.GetDefaultInstance() .ReadFromBinaryFile <IEditableDirWithChildren>(@"C:..\..\..\TemporaryFiles\tempFile~CopyCAW") .Children; AppMW.CurrentlyChosenDir.AddChildrenToChildrenList(children); DirManagement.GetDefaultInstance().AutoGenerateChildrenFullName(AppMW.CurrentlyChosenDir); AppMW.sorteritno.scale = (float)AppMW.ZoomSlider.Value; AppMW.sorteritno.ResetTree(AppMW.ResTree, AppMW.ResetHighlight, AppMW.Seed, AppMW.drzewo, "MW"); if (ThisButton.Name == "OkBtn") { this.Close(); } AddMemento(); } }
public void LoadAllTex() { foreach (string file in DirManagement.GetAllFiles(AppData.AssetsLocation())) { texLoaded.Add(texLoader.LoadTexture(AppData.AssetsLocation() + file)); } return; }
private void PasteChildrenDirs_Executed(object sender, ExecutedRoutedEventArgs e) { if (CurrentlyChosenDir.Description.FullName.Length < sorteritno.path_max_length ) { List<IEditableDirWithChildrenAndParent> CopyOfChildren = SaveAndReadElementInBinaryFile.GetDefaultInstance() .ReadFromBinaryFile<IEditableDirWithChildren>(@"C:..\..\..\TemporaryFiles\tempFile~Copy") .Children; int dirCount = 0; foreach (ChildDir childdir in CopyOfChildren) { dirCount += sorteritno.GetDirCount(childdir); } if (dirCount + sorteritno.dir_counter < sorteritno.dir_count_max) { var validate = DirValidate.GetDefaultInstance(); foreach (IEditableDirWithChildrenAndParent child in CopyOfChildren) { if (validate.IsDirExistingAsFolderAndChild(CurrentlyChosenDir, child.Description.Name)) { child.Description.Name = DirNameGenerator.GetDefaultInstance().GeneratetName_Default(CurrentlyChosenDir, 1, child.Description.Name); } child.ParentDir = CurrentlyChosenDir; } CurrentlyChosenDir.AddChildrenToChildrenList(CopyOfChildren); DirManagement.GetDefaultInstance().AutoGenerateChildrenFullName(CurrentlyChosenDir); int result = PasteFullNameControl(CurrentlyChosenDir); if (result > 0) { EMW = new ErrorMessageWindow(); EMW.SetMessage(4); EMW.ShowDialog(); } AddMemento(); sorteritno.ResetTree(ResTree, ResetHighlight, Seed, drzewo, "MW"); } else //wyswietl info o zbyt duzej ilosci dirow { EMW = new ErrorMessageWindow(); EMW.SetMessage(2); EMW.ShowDialog(); } } else { EMW = new ErrorMessageWindow(); EMW.SetMessage(3); EMW.ShowDialog(); } }
//funkcja podpieta do przycisku Utworz public void CreateCNTW_Executed(object sender, ExecutedRoutedEventArgs e) { AppMW.Seed = DirManagement.GetDefaultInstance().GetFolderAsNewMainDir(SeedLocation.Text); if (AppMW.Seed != null) //warunek zbey nie wypierdalalo bledu, ponizej rysowanie { AppMW.sorteritno.ResetTree(AppMW.ResTree, AppMW.ResetHighlight, AppMW.Seed, AppMW.drzewo, "MW"); } string filePath = @"..\..\saved\" + StructureName.Text; SaveAndReadElementInBinaryFile.GetDefaultInstance().WriteToBinaryFile <IEditableDirWithChildren>(filePath, AppMW.Seed); AppMW.thisStructureName = StructureName.Text; this.Close(); //ostatnia linijka - zamyka okno }
// dodaje childDir public void AddChildToChildrenList(IEditableDirWithChildrenAndParent child) { if (DirValidate.IsNameExistingInChildrenDirs(this, child.Description.Name)) { throw new InvalidOperationException($"folder named as {child.Description.Name} exist in structure"); } child.ParentDir = this; DirManagement.AutoGenerateDirFullName(child); if (DirValidate.IsfolderExisting(child.Description.FullName)) { throw new InvalidOperationException("you can't create folder that exist"); } Children.Add(child); }
// zawiera inicjalizację Dirów do testu public MainWindow() { InitializeComponent(); Panels.Add(PanelPliku); Panels.Add(PanelWidoku); Panels.Add(PanelEdycji); //HideAllPanels(); settings = new Settings(); settings.GetStyleSettings(); settings.GetMWSize(); settings.ApplyStyleMW(); orginatorGlobal = new Orginator(careTakerGlobal); // kurfa co to jest przemek IEditableDirWithChildren Assistant = DirManagement.GetDefaultInstance().GetFolderAsNewMainDir(@"C:\Users\Klakier\Desktop\generator struktury drzewiastej"); Seed = Assistant; ZoomSlider.Value = 1; AddMemento(); }
public void SetUp() { defaultDirManagement = DirManagement.GetDefaultInstance(); }