コード例 #1
0
 public bool?ShowDialog(out SmtpClientModel newSmtpClientModel)
 {
     //DialogResult = false;
     ShowDialog();
     newSmtpClientModel = currentSmtpClientModel;
     return(DialogResult);
 }
コード例 #2
0
 public static void update(SmtpClientModel smtpClient)
 {
     using (var db = new LiteDatabase(DbFileName))
     {
         var smtpClients = db.GetCollection <SmtpClientModel>("smtpClients");
         smtpClients.Update(smtpClient);
     }
 }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
 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);
     }
 }
コード例 #5
0
 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);
 }
コード例 #6
0
 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);
 }
コード例 #7
0
        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);
        }
コード例 #8
0
 public SmtpClientViewModel(SmtpClientModel smtpClientModel)
 {
     this.smtpClient          = smtpClientModel;
     SendEmailButtonInCommand = new SendEmailButtonClick();
 }