using MeksPhoneBook.Models;
using MeksPhoneBook.Services;
using ReactiveUI;
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Reactive;
namespace MeksPhoneBook.ViewModels;
public class HomeScreenViewModel : ViewModelBase
{
private Database _db;
private readonly List<ContactModel> _people;
public HomeScreenViewModel(Database db)
{
_db = db;
_people = _db.GetContacts();
NewContact = ReactiveCommand.Create(() => { });
FAQ = ReactiveCommand.Create(() => { });
Exit = ReactiveCommand.Create(() => { });
Edit = ReactiveCommand.Create<ContactModel, ContactModel>(ReturnContact, isTrue);
Delete = ReactiveCommand.Create<ContactModel, ContactModel>(ReturnContact, isTrue);
}
public ContactModel ReturnContact(ContactModel contact)
{
return contact;
}
public void JoinDiscord()
{
string target = "";
Process.Start(new ProcessStartInfo(target) { UseShellExecute = true });
}
public List<ContactModel> People => _people;
public ReactiveCommand<Unit, Unit> NewContact { get; }
public ReactiveCommand<Unit, Unit> FAQ { get; }
public ReactiveCommand<Unit, Unit> Exit { get; }
public ReactiveCommand<ContactModel, ContactModel> Edit { get; }
public ReactiveCommand<ContactModel, ContactModel> Delete { get; }
}
using MeksPhoneBook.Models;
using MeksPhoneBook.Services;
using ReactiveUI;
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Reactive;
namespace MeksPhoneBook.ViewModels;
public class HomeScreenViewModel : ViewModelBase
{
private Database _db;
private readonly List<ContactModel> _people;
public HomeScreenViewModel(Database db)
{
_db = db;
_people = _db.GetContacts();
NewContact = ReactiveCommand.Create(() => { });
FAQ = ReactiveCommand.Create(() => { });
Exit = ReactiveCommand.Create(() => { });
Edit = ReactiveCommand.Create<ContactModel, ContactModel>(ReturnContact, isTrue);
Delete = ReactiveCommand.Create<ContactModel, ContactModel>(ReturnContact, isTrue);
}
public ContactModel ReturnContact(ContactModel contact)
{
return contact;
}
public void JoinDiscord()
{
string target = "";
Process.Start(new ProcessStartInfo(target) { UseShellExecute = true });
}
public List<ContactModel> People => _people;
public ReactiveCommand<Unit, Unit> NewContact { get; }
public ReactiveCommand<Unit, Unit> FAQ { get; }
public ReactiveCommand<Unit, Unit> Exit { get; }
public ReactiveCommand<ContactModel, ContactModel> Edit { get; }
public ReactiveCommand<ContactModel, ContactModel> Delete { get; }
}