public MainPageViewModel() { ListOfItems.Add(new User()); LoginCommand = new Command((e) => { var item = (e as User); //TODO: LOGIN TO YOUR SYSTEM OnLoginCommandExecute(item); }); RegisterCommand = new Command((e) => { OnRegisterCommandExecute(); }); //} //public event PropertyChangedEventHandler PropertyChanged; //void OnPropertyChanged([CallerMemberName]string propertyName = "") => // PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); //public ICommand OnSignInCommandExecute { get; private set; } //public MainPageViewModel() //{ // //OnSignInCommandExecute = new Command<User>(OnLoginCommandExecute); // OnSignInCommandExecute = new Command((e) => // { // var item = e as User; // OnLoginCommandExecute(item); // }); //} //private bool CanOnLoginCommandExecute(User arg) //{ // return true; //} }
/// <summary> /// Opens a project from a file. /// </summary> /// <param name="path"></param> public void Open(string path) { string appData = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) + "\\Stv233\\ItemCreator\\"; Name = path.Substring(path.LastIndexOf("\\") + 1, path.LastIndexOf(".") - path.LastIndexOf("\\") - 1); try { Directory.Delete(appData + "\\Projects\\" + Name, true); } catch { } ZipFile.ExtractToDirectory(path, appData + "\\Projects\\" + Name); ListOfItems.Clear(); string[] ProjectData = File.ReadAllLines(appData + "\\Projects\\" + Name + "\\ProjectData"); if (ProjectData[0] == "AIS") { Type = Types.AIS; } else if (ProjectData[0] == "Pro") { Type = Types.Pro; } else if (ProjectData[0] == "Simple") { Type = Types.Simple; } else { throw new System.Exception("Unknown project type"); } Array.Copy(ProjectData, 1, ProjectData, 0, ProjectData.Length - 1); Array.Resize <string>(ref ProjectData, ProjectData.Length - 1); foreach (string itemName in ProjectData) { if (Type == Types.Simple) { SimpleItem item = new SimpleItem(itemName); item.Import(appData + "\\Projects\\" + Name + "\\" + itemName); ListOfItems.Add(itemName, item); } else if (Type == Types.Pro) { ProItem item = new ProItem(itemName); item.Import(appData + "\\Projects\\" + Name + "\\" + itemName); ListOfItems.Add(itemName, item); } else if (Type == Types.AIS) { AISItem item = new AISItem(itemName); item.Import(appData + "\\Projects\\" + Name + "\\" + itemName); ListOfItems.Add(itemName, item); } } }
public void AddItemList(string item, string description, List <string> Test) { ListOfItems.Add(Index, item); ListOfDescription.Add(Index, description); var TestDictonary = new Dictionary <int, string>(); foreach (string i in Test) { TestDictonary.Add(IndexList, i); IndexList += 1; } IndexList = 1; ListDictionaryItemList.Add(TestDictonary); ListOfItemList.Add(Index); Sideway.Add(1); Index += 1; }
private void addItemHandler() { try { if (Regex.IsMatch(ItemName, @"^[a-zA-Z0-9-øØ-æÆ-åÅ\s]+$")) { var itemID = _db.TableItem.CreateItem(ItemName, ItemGroupComboBoxList[ComboBoxIndex].ItemGroupID); var createdItem = new Item(itemID, ItemName, ItemGroupComboBoxList[ComboBoxIndex].ItemGroupID); ListOfItems.Add(new DisplayItem(createdItem)); _messageBox.OpenMessageBox($"{ItemName} er blevet tilføjet til databasen"); ItemName = ""; ComboBoxIndex = -1; } else { _messageBox.OpenMessageBox("Navnet på en vare kan kun indeholde bogstaver og tal"); } } catch (Exception exception) { _messageBox.OpenMessageBox("Noget gik galt! Check Debug for fejlmeddelelse"); Debug.WriteLine(exception.Message); } }
public void AddItem(string item, string description) { ListOfItems.Add(Index, item); ListOfDescription.Add(Index, description); Index += 1; }