private void btnLogout_Click(object sender, RoutedEventArgs e) { if (Authentification.Logout()) { EntryWindow entryW = new EntryWindow(); entryW.Show(); MainWindow w = (MainWindow)Window.GetWindow(this); w.Close(); } }
private void btnSubmit_Click(object sender, RoutedEventArgs e) { Client user = new Client(); user.Login = txtUsername.Text; user.Password = UnHash(txtPassword.Password); if (login(user)) { EntryWindow parentWindow = Window.GetWindow(this) as EntryWindow; parentWindow.Close(); } else { MessageBox.Show("Логин или пароль введены неверно"); } }
private void btnSubmit_Click(object sender, RoutedEventArgs e) { RegistrationController controller = new RegistrationController(); if (txtPassword.Password.Length >= 6 && txtPassword.Password == txtPasswordRepeat.Password) { User user = new User(txtUsername.Text, txtPassword.Password, txtUserEmail.Text); controller.Register(user); if (new LoginControl().login(user)) { EntryWindow parentWindow = Window.GetWindow(this) as EntryWindow; parentWindow.Close(); } } else { MessageBox.Show("Пароли не совпадают или короткий пароль."); } }
public void Startup() { _appApplicationEnvironment = new ApplicationEnvironment(); _appApplicationEnvironment.SetupApplicationEnvironment(); _appApplicationEnvironment.EventHub.Subscribe <AppExitMessage>(OnAppShutdownHandler); Logger.Log.Info("Init data models"); _entryModel = new EntryViewModel(_appApplicationEnvironment); _appViewModel = new ApplicationViewModel(_appApplicationEnvironment); _timersViewModel = new TimersViewModel(_appApplicationEnvironment); _reportsViewModel = new ReportsViewModel(_appApplicationEnvironment); _settingsViewModel = new SettingsViewModel(_appApplicationEnvironment); _notificationViewModel = new NotificationViewModel(_appApplicationEnvironment); _profileSettingsViewModel = new ProfileSettingsViewModel(_appApplicationEnvironment); Logger.Log.Info("Init dialog service"); _dialogService = new DialogService(); _dialogService.RegisterDialog <ConfirmationDialogModel, ConfirmationDialog>(); Logger.Log.Info("Init views"); _mainView = new MainWindow(_dialogService, _appViewModel); _entryWindow = new EntryWindow(_entryModel); _activityDetailsWindow = new ActivityDetailsWindow(_mainView, _timersViewModel); _notificationWindow = new NotificationWindow(_mainView, _notificationViewModel); _profileSettingsWindow = new ProfileSettingsWindow(_mainView, _profileSettingsViewModel); _timersViewPage = new TimersViewPage(_timersViewModel); _mainView.AddPage(_timersViewPage); _reportsViewPage = new ReportsViewPage(_reportsViewModel); _mainView.AddPage(_reportsViewPage); _settingsViewPage = new SettingsViewPage(_settingsViewModel); _mainView.AddPage(_settingsViewPage); _mainView.Run(); }
void Create(int n) { bool flag = false; switch (n) { case 0: BillWindow bw = new BillWindow(db); flag = bw.ShowDialog(); break; case 1: EntryWindow ew = new EntryWindow(db); flag = ew.ShowDialog(); break; case 2: ProductWindow pw = new ProductWindow(db); flag = pw.ShowDialog(); break; case 3: ServiceWindow sw = new ServiceWindow(db); flag = sw.ShowDialog(); break; case 4: ClientWindow cw = new ClientWindow(db); flag = cw.ShowDialog(); break; case 5: CarWashWindow cww = new CarWashWindow(db); flag = cww.ShowDialog(); break; } if (flag) { Refresh(n); } }
private void ViewPasswordTBl_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { TextBlock tb = (TextBlock)sender; PasswordBox pb = (PasswordBox)tb.TemplatedParent; var template = pb.Template; TextBox tb1 = (TextBox)template.FindName("PasswordShownLB", pb); EntryWindow.ShowHidePassword(pb); if (tb.Foreground != Brushes.White) { tb.Foreground = Brushes.AliceBlue; tb.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#1e90ff")); tb1.Text = pb.Password; tb1.Focus(); } else { tb.Background = Brushes.White; tb.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#1e90ff")); pb.Password = tb1.Text; tb1.Focus(); } }
private void Test_UpdateEntryWindow(object sender, EventArgs e) { dispatcherTimer.Start(); Dispatcher.Invoke(() => { ew = new EntryWindow((sender as AnswerFromHardverModel).ActualMember.Id); ew.Focusable = true; if ((sender as AnswerFromHardverModel).Enable) { ew.UserNameLabel.Content = (sender as AnswerFromHardverModel).ActualMember.FirstName; ew.CompanyLabel.Content = (sender as AnswerFromHardverModel).ActualMember.CompanyName; } else { ew.MessageLabel.Visibility = Visibility.Visible; } ew.ShowDialog(); BL.InitEntriesList(VM.Entries); EntriesListView.SelectedItem = EntriesListView.Items[0]; }); }
private void btnSubmit_Click(object sender, RoutedEventArgs e) { RegistrationController controller = new RegistrationController(); if (txtPasswordRepeat.Password != txtPassword.Password) { MessageBox.Show("пароли не совпадают"); return; } Client user = new Client(txtUsername.Text, txtPassword.Password, txtUserEmail.Text); user.maxCount = 1; user.role = 0; user.ChatId = 0; user.isActive = false; user.key = GetPhoto.GenRandomString(10); user.LastUpdate = DateTime.Parse("01 01 2019"); controller.Register(user); if (new LoginControl().login(user)) { EntryWindow parentWindow = Window.GetWindow(this) as EntryWindow; parentWindow.Close(); } }
public static async Task Initialize(EntryWindow caller) { TaskCompletionSource <bool> tcs = new TaskCompletionSource <bool>(); IntPtr handle = new WindowInteropHelper(caller).Handle; Key imgKey = ConfigHelper.ShortcutImgKey; Key gifKey = ConfigHelper.ShortcutGifKey; bool usePrint = ConfigHelper.UsePrint; try { _imgHotKey = usePrint ? new HotKey(handle, ModifierKeys.None, Key.PrintScreen) : new HotKey(handle, ModifierKeys.Control | ModifierKeys.Shift, imgKey); _imgHotKey.HotKeyPressed += OpenFromShortcutImg; } catch { //ignored } try { _gifHotKey = new HotKey(handle, ModifierKeys.Control | ModifierKeys.Shift, gifKey); _gifHotKey.HotKeyPressed += OpenFromShortcutGif; } catch { //ignored } ContextMenuStrip contextMenu = new ContextMenuStrip(); //Icons try { _iconGif = ImageHelper.LoadImage(Path.Combine(ConfigHelper.InstallDir, "Resources", "iconGif.png")); _iconHelp = ImageHelper.LoadImage(Path.Combine(ConfigHelper.InstallDir, "Resources", "iconHelp.png")); _iconSettings = ImageHelper.LoadImage(Path.Combine(ConfigHelper.InstallDir, "Resources", "iconSettings.png")); _iconExit = ImageHelper.LoadImage(Path.Combine(ConfigHelper.InstallDir, "Resources", "iconExit.png")); } catch { //Images not found } //Item: GIF ToolStripItem gifMenuItem = contextMenu.Items.Add(strings.gif); gifMenuItem.Image = _iconGif; gifMenuItem.Click += delegate { OpenFromShortcutGif(); }; gifMenuItem.Font = new Font(gifMenuItem.Font, gifMenuItem.Font.Style | FontStyle.Bold); //Item: - contextMenu.Items.Add(new ToolStripSeparator()); //Item: Help ToolStripItem helpMenuItem = contextMenu.Items.Add(strings.help); helpMenuItem.Image = _iconHelp; helpMenuItem.Click += delegate { try { Process.Start(Path.Combine(ConfigHelper.InstallDir, "PipeShot.UI.exe"), "help"); } catch { // ignored } }; //Item: Settings ToolStripItem settingsMenuItem = contextMenu.Items.Add(strings.settings); settingsMenuItem.Image = _iconSettings; settingsMenuItem.Click += delegate { try { Process.Start(Path.Combine(ConfigHelper.InstallDir, "PipeShot.UI.exe")); } catch { // ignored } }; //Item: Exit ToolStripItem exitMenuItem = contextMenu.Items.Add(strings.exit); exitMenuItem.Image = _iconExit; exitMenuItem.Click += delegate { DisposeJunk(); tcs.SetResult(true); }; //NotifyIcon _nicon = new NotifyIcon { Icon = Resources.Logo, ContextMenuStrip = contextMenu, Visible = true, Text = strings.clickorpress + (usePrint ? strings.printKeyShortcut : string.Format(strings.ctrlShiftShortcut, imgKey)) + strings.toSnipeNew }; _nicon.MouseClick += (sender, e) => { if (e.Button == MouseButtons.Left) { OpenFromShortcutImg(); } }; System.Windows.Application.Current.Exit += (sender, e) => { DisposeJunk(); }; await tcs.Task; }
private void view_entry(object sender, RoutedEventArgs e) { int row_idx = this.entries_list.SelectedIndex, idx = this.state.domain.entries.Count - row_idx - 1; if ((idx < 0) || (idx >= this.state.domain.entries.Count)) { return; } EntryWindow entry_window = new EntryWindow(this.state, idx) { Owner = this }; entry_window.ShowDialog(); if (!entry_window.valid) { return; } if (entry_window.topics is not null) { this.state.domain.topics = entry_window.topics; } if (entry_window.topic_refs is not null) { this.state.topic_refs = entry_window.topic_refs; } if (entry_window.notes is not null) { this.state.domain.notes = entry_window.notes; } decimal timestamp = entry_window.timestamp_box.calendar_value; DateTime created = entry_window.get_created(); string description = entry_window.description_box.Text; int session = (int)(entry_window.session_box.Value); Entry ent = this.state.domain.entries[idx]; bool changed = (timestamp != ent.timestamp) || (created != ent.created) || (description != ent.description) || (session != ent.session); if ((!changed) && (entry_window.actions.Count != ent.actions.Count)) { changed = true; } if (!changed) { for (int i = 0; i < entry_window.actions.Count; i++) { if (entry_window.actions[i] != ent.actions[i]) { changed = true; break; } } } if (!changed) { return; } this.state_dirty = true; this.state.domain.remove_entry(idx, true); this.entry_rows.RemoveAt(row_idx); this.state.remove_references(ent.actions); this.state.add_references(entry_window.actions); ent.timestamp = timestamp; ent.created = created; ent.description = description; ent.session = session; ent.actions = entry_window.actions; idx = this.state.domain.add_entry(ent); int valid_idx = this.state.domain.valid_entries - 1; if (valid_idx < 0) { valid_idx = this.state.domain.entries.Count - 1; } this.session_num_box.Content = (this.state.domain.entries[valid_idx].session ?? 0).ToString(); this.current_timestamp = this.state.domain.entries[valid_idx].timestamp; this.current_timestamp_box.Content = this.state.calendar.format_timestamp(this.current_timestamp, verbose: true); EntryRow row = new EntryRow( this.state.calendar.format_timestamp(ent.timestamp, verbose: true), idx >= this.state.domain.valid_entries, (ent.session ?? 0).ToString(), ent.created.ToString("G"), ent.description ); this.entry_rows.Insert(this.entry_rows.Count - idx, row); for (int i = 0; i < this.entry_rows.Count; i++) { this.entry_rows[i].set_invalid(this.entry_rows.Count - i > this.state.domain.valid_entries); } this.refresh_lists(); }
private void entry_action_callback( List <EntryAction> actions, Guid?entry_guid = null, Dictionary <Guid, Topic> topics = null, Dictionary <Guid, int> topic_refs = null, Dictionary <Guid, ExternalNote> notes = null ) { if (topics is not null) { this.state.domain.topics = topics; } if (topic_refs is not null) { this.state.topic_refs = topic_refs; } if (notes is not null) { this.state.domain.notes = notes; } if (actions is not null) { EntryWindow entry_window = new EntryWindow(this.state, actions: actions) { Owner = this }; entry_window.ShowDialog(); if (!entry_window.valid) { return; } if (entry_window.topics is not null) { this.state.domain.topics = entry_window.topics; } if (entry_window.topic_refs is not null) { this.state.topic_refs = entry_window.topic_refs; } if (entry_window.notes is not null) { this.state.domain.notes = entry_window.notes; } decimal timestamp = entry_window.timestamp_box.calendar_value; DateTime created = entry_window.get_created(); string description = entry_window.description_box.Text; int session = (int)(entry_window.session_box.Value); Entry ent = new Entry(timestamp, created, description, session, new List <EntryAction>(entry_window.actions), entry_guid); this.state_dirty = true; int idx = this.state.domain.add_entry(ent); this.state.add_references(ent.actions); int valid_idx = this.state.domain.valid_entries - 1; if (valid_idx < 0) { valid_idx = this.state.domain.entries.Count - 1; } this.session_num_box.Content = (this.state.domain.entries[valid_idx].session ?? 0).ToString(); this.current_timestamp = this.state.domain.entries[valid_idx].timestamp; this.current_timestamp_box.Content = this.state.calendar.format_timestamp(this.current_timestamp, verbose: true); EntryRow row = new EntryRow( this.state.calendar.format_timestamp(ent.timestamp, verbose: true), idx >= this.state.domain.valid_entries, (ent.session ?? 0).ToString(), ent.created.ToString("G"), ent.description ); this.entry_rows.Insert(this.entry_rows.Count - idx, row); for (int i = 0; i < this.entry_rows.Count; i++) { this.entry_rows[i].set_invalid(this.entry_rows.Count - i > this.state.domain.valid_entries); } } this.refresh_lists(); }
public EntryWindowVM(EntryWindow entryWindow, MainWindow mainWindow) { parent = mainWindow; this.entryWindow = entryWindow; }