public bool?ShowDialog(out SmtpClientModel newSmtpClientModel) { //DialogResult = false; ShowDialog(); newSmtpClientModel = currentSmtpClientModel; return(DialogResult); }
public static void update(SmtpClientModel smtpClient) { using (var db = new LiteDatabase(DbFileName)) { var smtpClients = db.GetCollection <SmtpClientModel>("smtpClients"); smtpClients.Update(smtpClient); } }
public static void delete(SmtpClientModel smtpClient) { using (var db = new LiteDatabase(DbFileName)) { var smtpClients = db.GetCollection <EventModel>("smtpClients"); smtpClients.Delete(x => x.Id == smtpClient.Id); } }
public static void init(string dbFileName = @"MySmtpClients.db") { DbFileName = dbFileName; DefualtSmtpClientModel = selectDefualt(); if (DefualtSmtpClientModel == null) { DefualtSmtpClientModel = new SmtpClientModel("smpt host", "sender Id (Email)", "password", false); DefualtSmtpClientModel.IsDefualt = true; // TODO: for more than one smtpClients insert(DefualtSmtpClientModel); } }
public SmtpClientWindow(SmtpClientModel smtpClientModel = null) { InitializeComponent(); if (smtpClientModel != null) { currentSmtpClientModel = new SmtpClientModel(smtpClientModel.Host, smtpClientModel.Email, smtpClientModel.Password, smtpClientModel.EmailSentSuccessful); } else { currentSmtpClientModel = new SmtpClientModel("", "", "", false); } this.SmtpClienView = new SmtpClientViewModel(currentSmtpClientModel); }
public EventsReminderViewModel(IEnumerable <EventModel> eventModels) { SmtpClientDB.init(); smtpClient = SmtpClientDB.DefualtSmtpClientModel; Console.WriteLine("smtpClient loaded from LiteDB"); Events = new ObservableCollection <EventViewModel>(); foreach (var item in eventModels) { Events.Add(new EventViewModel(item, this)); } EditButtonInCommand = new EditButtonClick(); DeleteButtonInCommand = new DeleteButtonClick(); AddButtonInCommand = new AddButtonClick(); EditSmtpClientButtonInCommand = new EditSmtpClientButtonClick(); ERunServiceButtonInCommand = new RunServiceButtonClick(); ServiceTimer.Tick += new EventHandler(ServiceTimer_Tick); ServiceTimer.Interval = new TimeSpan(0, 0, 1); }
public bool EditSmtpClientButton_Click() { SmtpClientModel newSmtpClientModel = new SmtpClientModel(smtpClient.Host, smtpClient.Email, smtpClient.Password, smtpClient.EmailSentSuccessful); SmtpClientWindow smtpClientWindow = new SmtpClientWindow(newSmtpClientModel); if (smtpClientWindow.ShowDialog(out newSmtpClientModel) == true) { smtpClient.Host = newSmtpClientModel.Host; smtpClient.Email = newSmtpClientModel.Email; smtpClient.Password = newSmtpClientModel.Password; smtpClient.EmailSentSuccessful = newSmtpClientModel.EmailSentSuccessful; smtpClient.IsDefualt = true; RefreshColorsAndContents(); SmtpClientDB.update(smtpClient); Console.WriteLine("smtpClient update to LiteDB"); return(true); } return(false); }
public SmtpClientViewModel(SmtpClientModel smtpClientModel) { this.smtpClient = smtpClientModel; SendEmailButtonInCommand = new SendEmailButtonClick(); }