private void PopulateElementSavesFromReferences(string projectRootDirectory, out string errors) { errors = ""; Screens.Clear(); Components.Clear(); StandardElements.Clear(); foreach (ElementReference reference in ScreenReferences) { ScreenSave toAdd = null; try { toAdd = reference.ToElementSave <ScreenSave>(projectRootDirectory, ScreenExtension, ref errors); } catch (Exception e) { errors += "\nError loading " + reference.Name + ":\n" + e.Message; } if (toAdd != null) { Screens.Add(toAdd); } } foreach (ElementReference reference in ComponentReferences) { ComponentSave toAdd = null; try { toAdd = reference.ToElementSave <ComponentSave>(projectRootDirectory, ComponentExtension, ref errors); } catch (Exception e) { errors += "\nError loading " + reference.Name + ":\n" + e.Message; } if (toAdd != null) { Components.Add(toAdd); } } foreach (ElementReference reference in StandardElementReferences) { StandardElementSave toAdd = null; try { toAdd = reference.ToElementSave <StandardElementSave>(projectRootDirectory, StandardExtension, ref errors); } catch (Exception e) { errors += "\nError loading " + reference.Name + ":\n" + e.Message; } if (toAdd != null) { StandardElements.Add(toAdd); } } }
public async Task CreateElementsAsync() { if (MainSql.UserHasOffice()) { OreOfficeButton.IsVisible = true; } _elements = await StandardElements.CreateAsync(new GetDate()); }
private static async Task <StandardElements> CreateTaskAsync() { var dateInterface = Substitute.For <IGetDate>(); dateInterface.GetCurrentDate().Returns(DateTime.Parse("2020-01-01")); MainSql.CreateConnection(); await MainSql.CkeckConnectionAsync(); await MainSql.CreateAsync(new TestUserHelpers(), new TestInternetAccess(), "1111"); return(await StandardElements.CreateAsync(dateInterface).ConfigureAwait(false)); }
/// <summary> /// Jeżeli element jest dodany to zwracamy jego klucz /// </summary> /// <param name="el"></param> /// <param name="name"></param> /// <returns></returns> public string AddElementOnMap(StandardElements el, string name) { if (!MapElements.Exists(x => x.Key == name)) { if (el == StandardElements.Gun) { MapElements.Add(new Gun(name)); return(name); } else if (el == StandardElements.SpawnPiont) { if (MapElements.FirstOrDefault(x => x.GetType() == typeof(SpawnPoint)) == null) { MapElements.Add(new SpawnPoint(name)); return(name); } else { return("There is already spawn point"); } } } if (el == StandardElements.ReverseIce) { if (MapPath.FirstOrDefault(x => x.Key == name) == null) { MapPath.Add(new RegularIce(name)); return(name); } else { return("There is already spawn point"); } } else if (el == StandardElements.NormalIce) { if (MapPath.FirstOrDefault(x => x.Key == name) == null) { MapPath.Add(new RegularIce(name)); return(name); } else { return("There is already spawn point"); } } return("Coś poszło nie tak"); }
public void ReloadElement(ElementSave element) { string projectRootDirectory = FileManager.GetDirectory(this.FullFileName); var gumLoadResult = new GumLoadResult(); if (element is ScreenSave) { var matchingReference = ScreenReferences.FirstOrDefault(item => item.Name == element.Name); ScreenSave newScreen = matchingReference?.ToElementSave <ScreenSave>( projectRootDirectory, GumProjectSave.ScreenExtension, gumLoadResult); if (newScreen != null) { Screens.Remove(element as ScreenSave); Screens.Add(newScreen); } } else if (element is ComponentSave) { var matchingReference = ComponentReferences.FirstOrDefault(item => item.Name == element.Name); ComponentSave newComonent = matchingReference?.ToElementSave <ComponentSave>( projectRootDirectory, GumProjectSave.ComponentExtension, gumLoadResult); if (newComonent != null) { Components.Remove(element as ComponentSave); Components.Add(newComonent); } } else if (element is StandardElementSave) { var matchingReference = StandardElementReferences.FirstOrDefault(item => item.Name == element.Name); StandardElementSave newStandardElement = matchingReference?.ToElementSave <StandardElementSave>( projectRootDirectory, GumProjectSave.ComponentExtension, gumLoadResult); if (newStandardElement != null) { StandardElements.Remove(element as StandardElementSave); StandardElements.Add(newStandardElement); } } }
private void PopulateElementSavesFromReferences(string projectRootDirectory, LinkLoadingPreference linkLoadingPreference, GumLoadResult result) { string errors = ""; Screens.Clear(); Components.Clear(); StandardElements.Clear(); Behaviors.Clear(); foreach (ElementReference reference in ScreenReferences) { ScreenSave toAdd = null; try { toAdd = reference.ToElementSave <ScreenSave>(projectRootDirectory, ScreenExtension, result); } catch (Exception e) { errors += "\nError loading " + reference.Name + ":\n" + e.Message; } if (toAdd != null) { Screens.Add(toAdd); } } foreach (ElementReference reference in ComponentReferences) { ComponentSave toAdd = null; try { toAdd = reference.ToElementSave <ComponentSave>(projectRootDirectory, ComponentExtension, result); } catch (Exception e) { errors += "\nError loading " + reference.Name + ":\n" + e.Message; } if (toAdd != null) { Components.Add(toAdd); } } foreach (ElementReference reference in StandardElementReferences) { StandardElementSave toAdd = null; try { toAdd = reference.ToElementSave <StandardElementSave>(projectRootDirectory, StandardExtension, result); } catch (Exception e) { errors += "\nError loading " + reference.Name + ":\n" + e.Message; } if (toAdd != null) { StandardElements.Add(toAdd); } } foreach (var reference in BehaviorReferences) { BehaviorSave toAdd = null; try { toAdd = reference.ToBehaviorSave(projectRootDirectory); } catch (Exception e) { errors += "\nError loading " + reference.Name + ":\n" + e.Message; } if (toAdd != null) { Behaviors.Add(toAdd); } } result.ErrorMessage += errors; }
public HomeAddPage(StandardElements elements, in Home home)