public loginModelView() { login = new CommandPar((p) => { var passwordBox = p as PasswordBox; var password = passwordBox.Password; var user = Ico.getValue <db>().GetUnivdb().users.ToList().Where(u => u.username.Equals(username) && u.passoword.Equals(password)).ToList().FirstOrDefault(); if (user == null) { erour = Visibility.Visible; } else { erour = Visibility.Collapsed; Ico.ResetValue <user>(user); MainWindow main = new MainWindow(); main.Show(); App.Current.MainWindow.Close(); App.Current.MainWindow = main; Ico.getValue <ContentApp>().OpenSample4Dialog(); Ico.getValue <ContentApp>().Sample4Content = new Messagebox(new List <string> { "أهلا وسهلا بك يا " + user.name }, Ico.getValue <ContentApp>().CancelSample4Dialog, true); } }); }
public MainWindow() { InitializeComponent(); // univdb db = new univdb(); // MessageBox.Show((db.processes.ToList())[0].date + ""); ContentApp contentApp = new ContentApp(this); if (Ico.getValue <ContentApp>() == null) { Ico.setValue <ContentApp>(contentApp); } else { Ico.ResetValue <ContentApp>(contentApp); } this.DataContext = Ico.getValue <ContentApp>(); }
public SettingModelView() { val = Ico.getValue <db>().GetUnivdb().settings.ToList().FirstOrDefault(); TempalePath = val.locationTem; PathFileSave = val.locationFile; date = DateTime.Now; PathFileSavec = new Command(() => { var folderDialog = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog(); var folderResult = folderDialog.ShowDialog(); if (folderResult.HasValue && folderResult.Value) { PathFileSave = folderDialog.SelectedPath; } }); TempalePathc = new Command(() => { var folderDialog = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog(); var folderResult = folderDialog.ShowDialog(); if (folderResult.HasValue && folderResult.Value) { TempalePath = folderDialog.SelectedPath; } }); savecommand = new Command(() => { erour = new List <string>(); if (PathFileSave.ToString().Length == 0) { erour.Add("الرجاء كتابة مسار حفظ الملفات "); } if (TempalePath.ToString().Length == 0) { erour.Add("الرجاء كتابة مسار قوالب "); } if (date == null) { erour.Add("الرجاء تحديد تاريخ البرنامج "); } else { if (Ico.getValue <Date>().GetNowDate().year1.Year > date.Year) { erour.Add("الرجاء تحديد تاريخ صحيح "); } } Ico.getValue <ContentApp>().OpenSample4Dialog(); if (erour.Count != 0) { Ico.getValue <ContentApp>().Sample4Content = new Messagebox(erour, () => { Ico.getValue <ContentApp>().CancelSample4Dialog(); }); } else { if (Ico.getValue <db>().GetUnivdb().settings.ToList().FirstOrDefault().date.Year != date.Year) { Ico.getValue <ContentApp>().Sample4Content = new YesOrNo("هل تريد تغير تاريخ البرنامج ذالك سيغر الكثر في البرناج الرجاء الحذر ...", () => { Ico.getValue <db>().GetUnivdb().years.Add(new year() { year1 = date }); }, () => { Ico.getValue <ContentApp>().CancelSample4Dialog(); }); } Ico.getValue <db>().GetUnivdb().settings.ToList().FirstOrDefault().locationFile = PathFileSave; Ico.getValue <db>().GetUnivdb().settings.ToList().FirstOrDefault().locationTem = TempalePath; Ico.getValue <db>().GetUnivdb().settings.ToList().FirstOrDefault().date = date; Ico.getValue <db>().savedb(); Ico.ResetValue <Date>(new Date()); Ico.ResetValue <setting>(Ico.getValue <db>().GetUnivdb().settings.ToList().FirstOrDefault()); Ico.ResetValue <IO>(new IO()); Ico.getValue <ContentApp>().Sample4Content = new Messagebox(new List <string> { "تم التعديل بنجاح.. " }, Ico.getValue <ContentApp>().CancelSample4Dialog); } }); }