コード例 #1
0
        private void FindContactCommandExecuted()
        {
            RaisePropertyChanged("DisableParentWindow");

            var window = new ContactsListView();

            window.ShowDialog();

            RaisePropertyChanged("EnableParentWindow");

            if (window.DialogResult == null || window.DialogResult != true || window.ViewModel.SelectedContact == null)
            {
                return;
            }

            // For database
            var eventContact = new EventContact()
            {
                ID        = Guid.NewGuid(),
                EventID   = _event.Event.ID,
                ContactID = window.ViewModel.SelectedContact.Contact.ID
            };

            // For event data contex
            var linkedContact = new EventContact()
            {
                ID      = eventContact.ID,
                EventID = eventContact.EventID,
                Contact = window.ViewModel.SelectedContact.Contact
            };

            _event.EventContacts.Add(linkedContact);
            _eventsDataUnit.EventContactsRepository.Add(eventContact);
        }
コード例 #2
0
 private void OnContactPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "IsFavorite" && ActiveTab == 1)
     {
         ContactsListView.Refresh();
     }
 }
コード例 #3
0
        private void SetupControls()
        {
            this.fgvMembers        = new FlatGridView();
            this.lsvMemberContacts = new ContactsListView();
            this.Dock                   = DockStyle.Fill;
            this.tlpMain.Dock           = DockStyle.Fill;
            this.fgvMembers.Dock        = DockStyle.Fill;
            this.lsvMemberContacts.Dock = DockStyle.Fill;

            if (DomainModel.Application.ResourceManager != null)
            {
                this.editToolbar.Title = DomainModel.
                                         Application.ResourceManager.GetText("lbl_contacts");
            }

            if (Presentation.View.Theme != null)
            {
                this.BackColor             = Presentation.View.Theme.TourGroupItemBackColor;
                this.editToolbar.BackColor = this.BackColor;

                this.fgvMembers.Font = Presentation.View.Theme.FormLabelFont;
            }

            this.fgvMembers.HiddenColumnNames.Add("MemberShip");
            this.fgvMembers.HiddenColumnNames.Add("Title");
            this.fgvMembers.HiddenColumnNames.Add("FirstName");
            this.fgvMembers.HiddenColumnNames.Add("LastName");
            this.fgvMembers.HiddenColumnNames.Add("Contacts");
            this.fgvMembers.HiddenColumnNames.Add("IsInPhonebook");
            this.fgvMembers.HiddenColumnNames.Add("IsEmployee");
            this.fgvMembers.ColumnHeadersVisible = false;
            this.fgvMembers.Margin = new Padding(2, 2, 1, 2);

            this.lsvMemberContacts.Margin = new Padding(0, 2, 2, 2);

            this.tlpMain.Controls.Add(this.fgvMembers, 0, 1);
            this.tlpMain.Controls.Add(this.lsvMemberContacts, 1, 1);

            this.fgvMembers.SelectionChanged += new
                                                EventHandler(fgvMembers_SelectionChanged);

            /*
             * this.editToolbar.AddButtonClick += new
             *  EventHandler(editToolbar_AddButtonClick);*/

            this.editToolbar.EditButtonClick += new
                                                EventHandler(editToolbar_EditButtonClick);

            this.editToolbar.DeleteButtonClick += new
                                                  EventHandler(editToolbar_DeleteButtonClick);

            this.mnuContacts                = new ContactsMenu();
            this.mnuContacts.ClickAction    = OnContactMenu;
            this.mnuContacts.Persons        = DomainModel.Phonebook.GetAll();
            this.editToolbar.AddContextMenu = this.mnuContacts;
        }
コード例 #4
0
        private void ContactChanged(object sender, ContactEventArgs e)
        {
            if (ServiceManager.Instance.Dispatcher.Thread != System.Threading.Thread.CurrentThread)
            {
                ServiceManager.Instance.Dispatcher.BeginInvoke((Action)(() => this.ContactChanged(sender, e)));
                return;
            }

            if (ContactsListView != null)
            {
                ContactsListView.Refresh();
            }
        }
コード例 #5
0
        private void ShowFindContactWindowCommandExecuted()
        {
            RaisePropertyChanged("DisableParentWindow");

            var view = new ContactsListView();

            view.ShowDialog();

            RaisePropertyChanged("EnableParentWindow");

            if (view.DialogResult != null && view.DialogResult.Value && view.ViewModel.SelectedContact != null)
            {
                Contact = view.ViewModel.SelectedContact;
            }
        }
コード例 #6
0
        private void AddContactButton_OnClick(object sender, RoutedEventArgs e)
        {
            var entry = new Contact();

            if (ViewModel.SelectedContact != null)
            {
                ViewModel.Contacts.Insert(ViewModel.Contacts.IndexOf(ViewModel.SelectedContact) + 1, entry);
            }
            else
            {
                ViewModel.Contacts.Add(entry);
            }

            ViewModel.SelectedContact = entry;
            ContactsListView.ScrollIntoView(ViewModel.SelectedContact);
        }
コード例 #7
0
 protected override void RefreshContactsList()
 {
     //****************************************************************************************
     // Refresh the contact list of Chat.
     //*****************************************************************************************
     try
     {
         if (ContactsListView != null && ContactsListView.SourceCollection != null)
         {
             ContactsListView.Refresh();
         }
     }
     catch (Exception)
     {
     }
     OnPropertyChanged("ContactsListView");
 }
コード例 #8
0
        private void ShowFindContactWindowCommandExecuted()
        {
            RaisePropertyChanged("DisableParentWindow");

            var contactList = new ContactsListView();

            contactList.ShowDialog();

            RaisePropertyChanged("EnableParentWindow");

            if (contactList.DialogResult == null || contactList.DialogResult != true || contactList.ViewModel.SelectedContact == null)
            {
                return;
            }

            Contact = contactList.ViewModel.SelectedContact;
        }
コード例 #9
0
ファイル: AddMemberViewModel.cs プロジェクト: syatin003/Wpf
        private void ShowFindContactWindowCommandExecuted()
        {
            RaisePropertyChanged("DisableParentWindow");

            var view = new ContactsListView(true);

            view.ShowDialog();

            RaisePropertyChanged("EnableParentWindow");

            if (view.DialogResult != null && view.DialogResult.Value && view.ViewModel.SelectedContact != null)
            {
                Member.Contact    = view.ViewModel.SelectedContact;
                Member.Member.ID  = Member.Contact.Contact.ID;
                IsExistingContact = true;
                IsIgnored         = true;
                Member.Contact.PropertyChanged += Contact_PropertyChanged;
            }
        }
コード例 #10
0
 private void RemoveContactModel(ContactID contactID)
 {
     //*************************************************************************************************************************************************
     // Remove contact and update contact list.
     //*************************************************************************************************************************************************
     lock (this.Contacts)
     {
         foreach (var contact in Contacts)
         {
             if (contact.Contact == contactID)
             {
                 contact.PropertyChanged -= OnContactPropertyChanged;
                 Contacts.Remove(contact);
                 ContactsListView.Refresh();
                 break;
             }
         }
     }
 }
コード例 #11
0
        private void AddContact(VATRPContact contact, bool refreshNow = false)
        {
            if (!contact.SipUsername.NotBlank() || !contact.IsLinphoneContact)
            {
                return;
            }

            if (FindContact(contact) != null)
            {
                return;
            }

            lock (this.Contacts)
            {
                contact.PropertyChanged += OnContactPropertyChanged;
                Contacts.Add(new ContactViewModel(contact));
            }

            if (refreshNow)
            {
                ContactsListView.Refresh();
            }
        }
コード例 #12
0
        private void SetupControls()
        {
            this.fgvMembers        = new FlatGridView();
            this.lsvMemberContacts = new ContactsListView();
            //this.Dock = DockStyle.Fill;
            this.tlpMain.Dock           = DockStyle.Fill;
            this.fgvMembers.Dock        = DockStyle.Fill;
            this.lsvMemberContacts.Dock = DockStyle.Fill;

            this.editToolbar = new EditToolbar();
            this.editToolbar.ButtonAutohide = false;
            this.editToolbar.Anchor         = AnchorStyles.Top |
                                              AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom;
            this.editToolbar.Title = "";

            /*
             * if (DomainModel.Application.ResourceManager != null)
             * {
             *  this.editToolbar.Title = DomainModel.
             *      Application.ResourceManager.GetText("lbl_contacts");
             * }*/

            if (Presentation.View.Theme != null)
            {
                this.BackColor             = Presentation.View.Theme.TourGroupItemBackColor;
                this.editToolbar.BackColor = this.BackColor;

                this.fgvMembers.Font = Presentation.View.Theme.FormLabelFont;
            }

            this.fgvMembers.HiddenColumnNames.Add("MemberShip");
            this.fgvMembers.HiddenColumnNames.Add("Title");
            this.fgvMembers.HiddenColumnNames.Add("FirstName");
            this.fgvMembers.HiddenColumnNames.Add("LastName");
            this.fgvMembers.HiddenColumnNames.Add("Contacts");
            this.fgvMembers.HiddenColumnNames.Add("IsInPhonebook");
            this.fgvMembers.HiddenColumnNames.Add("IsEmployee");
            this.fgvMembers.ColumnHeadersVisible = false;
            this.fgvMembers.Margin = new Padding(2, 2, 1, 2);

            this.lsvMemberContacts.Margin = new Padding(0, 2, 2, 2);

            this.tlpMain.Controls.Add(this.editToolbar, 0, 0);
            this.tlpMain.Controls.Add(this.fgvMembers, 0, 1);
            this.tlpMain.Controls.Add(this.lsvMemberContacts, 1, 1);

            this.tlpMain.SetColumnSpan(this.editToolbar, 2);

            this.fgvMembers.SelectionChanged += new
                                                EventHandler(fgvMembers_SelectionChanged);

            this.editToolbar.AddButtonClick += new
                                               EventHandler(editToolbar_AddButtonClick);

            this.editToolbar.EditButtonClick += new
                                                EventHandler(editToolbar_EditButtonClick);

            this.editToolbar.DeleteButtonClick += new
                                                  EventHandler(editToolbar_DeleteButtonClick);

            this.fgvMembers.SetDataSource(DomainModel.Phonebook.GetAll());
        }
コード例 #13
0
 private void onListViewButtonChecked(object sender, RoutedEventArgs e)
 {
     ContactsListView.View   = ContactsListView.FindResource("PlainView") as ViewBase;
     DataGridView.Visibility = Visibility.Collapsed;
     Sort.Visibility         = Visibility.Visible;
 }