public MessageWindow(GoogleVoice.Contact Contact)
        {
            InitializeComponent();
            this.Contact = Contact;
            Title = Contact.Name;
            Tag = Contact.Name + Contact.ID;

            System.Windows.Forms.Application.EnableVisualStyles();

            // FIXME: maybe windows should start minimzed normally.
            ContentRendered += (s, e) => this.Topmost = false;
            Initialized += (s, e) => this.Topmost = true;

            OnZoomChanged += () => this.Invoke(() => SetHTMLFont());

            PreviewMouseDown += (ss, ee) =>
                {
                    this.Try(() => ClearNotify());
                };

            Loaded += (_, __) =>
                {
                    // 5/5/12: Open links in default browser
                    ((SHDocVw.DWebBrowserEvents2_Event)web.ActiveXInstance).NewWindow3 += web_NewWindow3;
                };
        }
예제 #2
0
        public MessageWindow(GoogleVoice.Contact Contact)
        {
            InitializeComponent();
            this.Contact = Contact;
            Title        = Contact.Name;
            Tag          = Contact.Name + Contact.ID;

            System.Windows.Forms.Application.EnableVisualStyles();

            // FIXME: maybe windows should start minimzed normally.
            ContentRendered += (s, e) => this.Topmost = false;
            Initialized     += (s, e) => this.Topmost = true;

            OnZoomChanged += () => this.Invoke(() => SetHTMLFont());

            PreviewMouseDown += (ss, ee) =>
            {
                this.Try(() => ClearNotify());
            };

            Loaded += (_, __) =>
            {
                // 5/5/12: Open links in default browser
                ((SHDocVw.DWebBrowserEvents2_Event)web.ActiveXInstance).NewWindow3 += web_NewWindow3;
            };
        }
예제 #3
0
        private void Contact_Click(object sender, MouseButtonEventArgs e)
        {
            try
            {
                GoogleVoice.Contact ct = lsvContacts.SelectedItem as GoogleVoice.Contact;
                if (ct == null)
                {
                    return;
                }
                var mw = WindowForContact(ct);

                this.InvokeDelay(100, () =>
                {
                    this.Try(() => mw.ShowActivated = true);
                    mw.Show();
                    mw.Activate();
                });
                lsvContacts.SelectedIndex = -1;
                txtSearch.Focus();
                if (Settings.Get("HideAfterSelect", false))
                {
                    DoHide();
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine("Main/Contact_Click *** " + ex);
            }
        }
예제 #4
0
        void model_OnMessage(GoogleVoice.Message msg, GoogleVoice.Contact contact)
        {
            bool did_add = false;

            GoogleVoice.SMS sms = msg as GoogleVoice.SMS;
            if (sms != null)
            {
                if (!sms.Self)
                {
                    did_add = true;
                }
            }
            if (!did_add)
            {
                return;
            }

            this.Invoke(() =>
            {
                var mw = WindowForContact(contact);
                // ShowActivated may crash on XP.
                this.Try(() => mw.ShowActivated = false);
                if (!mw.Ready)
                {
                    mw.Show();
                }
                mw.AddMessage(msg);
            });
        }
예제 #5
0
        public MessageWindow WindowForContact(GoogleVoice.Contact contact)
        {
            try
            {
                var win = Windows.FirstOrDefault(c => c.Contact == contact);
                if (win != null)
                {
                    return(win);
                }

                win = Windows.FirstOrDefault(c => c.Contact.HasNumber(contact.Phones[0].Number));
                if (win != null)
                {
                    return(win);
                }

                win = new MessageWindow(contact);
                Windows.Add(win);
                return(win);
            }
            catch (Exception ex)
            {
                Trace.WriteLine("Main/WindowForContact *** " + ex);
                return(null);
            }
        }
예제 #6
0
        private void mnuPinUnpin_Click(object sender, RoutedEventArgs e)
        {
            GoogleVoice.Contact c = lsvContacts.SelectedItem as GoogleVoice.Contact;
            if (c != null)
            {
                c.Group = (c.Group == "Favorites") ? "Other Contacts" : "Favorites";
                lsvContacts.ItemsSource = model.Contacts;
                txtSearch.Text          = "";

                SyncContactsJumpList();
                this.InvokeDelay(100, () =>
                {
                    CollectionView myView = (CollectionView)CollectionViewSource.GetDefaultView(lsvContacts.ItemsSource);
                    myView.Refresh();
                });
            }
        }
예제 #7
0
 private void mnuContactsList_ContextMenuOpening(object sender, ContextMenuEventArgs e)
 {
     GoogleVoice.Contact c = lsvContacts.SelectedItem as GoogleVoice.Contact;
     if (c != null)
     {
         if (c.Group == "Favorites")
         {
             mnuPinUnpin.Header = "Unpin " + c.Name;
         }
         else if (c.Group == "Dial")
         {
             e.Handled = true;
             return;
         }
         else
         {
             mnuPinUnpin.Header = "Pin " + c.Name;
         }
         return;
     }
     e.Handled = true; // dont show otherwise
 }