Beispiel #1
0
        private async void SaveAccount()
        {
            await Frontend.RunAsync(() =>
            {
                var account = CurrentAccount;

                if (account == null)
                {
                    account = Frontend.Accounts.New();
                }

                if (account != null)
                {
                    if (
                        Title.Text.Length == 0 ||
                        Jid.Text.Length == 0 ||
                        Password.Password.Length == 0 ||
                        Host.Text.Length == 0 ||
                        ColorSelector.SelectedItem == null ||
                        Port.Text.Length == 0)
                    {
                        Warning.Visibility = Windows.UI.Xaml.Visibility.Visible;
                        return;
                    }

                    account.title = this.Title.Text;

                    ComboBoxItem selectedColor = ColorSelector.SelectedItem as ComboBoxItem;
                    if (selectedColor != null)
                    {
                        account.color = (string)selectedColor.Tag;
                    }
                    else
                    {
                        account.color = "Gray";
                    }

                    account.jid      = this.Jid.Text;
                    account.password = this.Password.Password;

                    account.host        = this.Host.Text;
                    account.port        = Convert.ToInt32(this.Port.Text);
                    account.usesssl     = this.SSL.IsOn;
                    account.oldstylessl = this.OldSSL.IsOn;

                    account.authplain  = this.Plain.IsOn;
                    account.authmd5    = this.MD5.IsOn;
                    account.authscram  = this.SCRAM.IsOn;
                    account.authoauth2 = false;

                    account.requestConnectedStandby = this.ConnectedStandby.IsOn;
                    account.persistantState         = AccountState.Enabled;

                    Frontend.Backend.UpdateConnections();
                }

                flyoutSelf.Hide();
            });
        }
Beispiel #2
0
        private async void OnAllow(object sender, RoutedEventArgs e)
        {
            await Frontend.RunAsync(() =>
            {
                XMPPHelper.Subscribed(CurrentContact);
            });

            flyoutSelf.Hide();
        }
Beispiel #3
0
 private async void OnYes(object sender, RoutedEventArgs e)
 {
     if (CurrentContact != null)
     {
         await Frontend.RunAsync(() =>
         {
             XMPPHelper.RemoveContact(CurrentContact);
         });
     }
     flyoutSelf.Hide();
 }
Beispiel #4
0
        private async void OnSave(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(Alias.Text))
            {
                Warning.Visibility = Windows.UI.Xaml.Visibility.Visible;
                return;
            }

            var account = Frontend.Accounts[CurrentContact.account];

            if (account != null)
            {
                await Frontend.RunAsync(() =>
                {
                    XMPPHelper.EditContact(account, CurrentContact.jid, Alias.Text);
                });

                flyoutSelf.Hide();
            }
        }
Beispiel #5
0
        private async void OnAdd(object sender, RoutedEventArgs e)
        {
            var account = AccountSelector.SelectedItem as Account;
            var jid     = new XMPP.JID(Jid.Text);

            if (account == null ||
                string.IsNullOrEmpty(jid.Bare) ||
                string.IsNullOrEmpty(jid.Server) ||
                string.IsNullOrEmpty(jid.User))
            {
                Warning.Visibility = Windows.UI.Xaml.Visibility.Visible;
                return;
            }

            await Frontend.RunAsync(() =>
            {
                XMPPHelper.CreateContact(account, jid, Alias.Text);
            });

            flyoutSelf.Hide();
        }
Beispiel #6
0
        private void OnHide(object sender, RoutedEventArgs e)
        {
            var button = sender as Button;

            if (button != null)
            {
                var notification = button.Tag as Notification;
                Frontend.Notifications.NotificationList.Remove(notification);
            }

            if (Frontend.Notifications.NotificationCount <= 0)
            {
                flyoutSelf.Hide();
            }
        }
Beispiel #7
0
        public Flyout(FlyoutType type, object data = null, Flyout parent = null, bool settingsPaneParent = false)
        {
            Parent             = parent;
            SettingsPaneParent = settingsPaneParent;

            // Get bounds
            Rect   WindowBounds  = Window.Current.Bounds;
            double settingsWidth = GetFlyoutWidth(type);

            internalPopup         = new Popup();
            internalPopup.Opened += OnPopupOpened;
            internalPopup.Closed += OnPopupClosed;


            // Popup settings
            internalPopup.IsLightDismissEnabled = true;
            internalPopup.Width  = settingsWidth;
            internalPopup.Height = WindowBounds.Height;

            // Animations
            internalPopup.ChildTransitions = new TransitionCollection();
            internalPopup.ChildTransitions.Add(new PaneThemeTransition()
            {
                Edge = (SettingsPane.Edge == SettingsEdgeLocation.Right) ? EdgeTransitionLocation.Right : EdgeTransitionLocation.Left
            });

            // FlyoutControl
            FlyoutControl ctlFlyout = new FlyoutControl(this, type, data);

            ctlFlyout.Width     = settingsWidth;
            ctlFlyout.Height    = WindowBounds.Height;
            internalPopup.Child = ctlFlyout;

            // Popup position
            internalPopup.SetValue(Canvas.LeftProperty, SettingsPane.Edge == SettingsEdgeLocation.Right ? (WindowBounds.Width - settingsWidth) : 0);
            internalPopup.SetValue(Canvas.TopProperty, 0);

            Show();

            if (Parent != null)
            {
                Parent.Hide();
            }
        }
Beispiel #8
0
        public Flyout(FlyoutType type, object data = null, Flyout parent = null, bool settingsPaneParent = false)
        {
            Parent = parent;
            SettingsPaneParent = settingsPaneParent;

            // Get bounds
            Rect WindowBounds = Window.Current.Bounds;
            double settingsWidth = GetFlyoutWidth(type);

            internalPopup = new Popup();
            internalPopup.Opened += OnPopupOpened;
            internalPopup.Closed += OnPopupClosed;


            // Popup settings
            internalPopup.IsLightDismissEnabled = true;
            internalPopup.Width = settingsWidth;
            internalPopup.Height = WindowBounds.Height;

            // Animations
            internalPopup.ChildTransitions = new TransitionCollection();
            internalPopup.ChildTransitions.Add(new PaneThemeTransition()
            {
                Edge = (SettingsPane.Edge == SettingsEdgeLocation.Right) ? EdgeTransitionLocation.Right : EdgeTransitionLocation.Left
            });

            // FlyoutControl
            FlyoutControl ctlFlyout = new FlyoutControl(this, type, data);
            ctlFlyout.Width = settingsWidth;
            ctlFlyout.Height = WindowBounds.Height;
            internalPopup.Child = ctlFlyout;

            // Popup position
            internalPopup.SetValue(Canvas.LeftProperty, SettingsPane.Edge == SettingsEdgeLocation.Right ? (WindowBounds.Width - settingsWidth) : 0);
            internalPopup.SetValue(Canvas.TopProperty, 0);

            Show();

            if (Parent != null)
                Parent.Hide();
        }
Beispiel #9
0
 private void OnCancel(object sender, RoutedEventArgs e)
 {
     flyoutSelf.Hide();
 }