Example #1
0
 private void Hybrid_OnTap(object sender, GestureEventArgs e)
 {
     AppBarPanel.Close();
     Telegram.Api.Helpers.Execute.BeginOnUIThread(TimeSpan.FromSeconds(0.25), () =>
     {
         Hybrid_OnClick(null, null);
     });
 }
        protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
        {
            if (MorePanel.Visibility == Visibility.Visible)
            {
                AppBarPanel.Close();
            }

            base.OnNavigatingFrom(e);
        }
        private void SettingsView_OnBackKeyPress(object sender, CancelEventArgs e)
        {
            var popups = VisualTreeHelper.GetOpenPopups().ToList();
            var popup  = popups.FirstOrDefault();

            if (popup != null)
            {
                e.Cancel = true;

                var multiplePhotoChooser = popup.Child as OpenPhotoPicker;
                if (multiplePhotoChooser != null)
                {
                    multiplePhotoChooser.TryClose();
                }

                var cropControl = popup.Child as CropControl;
                if (cropControl != null)
                {
                    cropControl.TryClose();
                }

                return;
            }

            if (MorePanel.Visibility == Visibility.Visible)
            {
                AppBarPanel.Close();
                e.Cancel = true;
            }

            if (ViewModel.ProfilePhotoViewer != null &&
                ViewModel.ProfilePhotoViewer.IsOpen)
            {
                ViewModel.ProfilePhotoViewer.CloseViewer();
                e.Cancel = true;
                return;
            }
        }
 private void LogOutMenuItem_OnTap(object sender, GestureEventArgs e)
 {
     AppBarPanel.Close();
     Execute.BeginOnUIThread(TimeSpan.FromSeconds(0.25), () => ViewModel.LogOut());
 }
 private void ClearLogsMenuItem_OnTap(object sender, GestureEventArgs e)
 {
     AppBarPanel.Close();
     Execute.BeginOnUIThread(() => ViewModel.ClearLogs());
 }
 private void PrivacyPolicyMenuItem_OnTap(object sender, GestureEventArgs e)
 {
     AppBarPanel.Close();
     Execute.BeginOnUIThread(() => ViewModel.OpenPrivacyPolicy());
 }
 private void EditNameButton_OnTap(object sender, GestureEventArgs e)
 {
     AppBarPanel.Close();
     Execute.BeginOnUIThread(() => ViewModel.EditProfile());
 }
Example #8
0
        public ContactView()
        {
            var timer = Stopwatch.StartNew();

            InitializeComponent();

            var isLightTheme = (Visibility)Application.Current.Resources["PhoneLightThemeVisibility"] == Visibility.Visible;

            if (isLightTheme)
            {
                //NotificationsSwitch.Style = (Style)Application.Current.Resources["ProfileLightToggleSwitch"];
                LayoutRoot.Background = ShellView.CaptionBrush;
                AppBarPanel.MorePanelBackgroundBrush = ShellView.CaptionBrush;
                AppBarPanel.BackgroundBrush          = ShellView.CaptionBrush;
                foreach (var button in AppBarPanel.Buttons)
                {
                    var appBarButton = button as TelegramAppBarButton;
                    if (appBarButton != null)
                    {
                        appBarButton.LabelForeground = new SolidColorBrush(Colors.White);
                    }
                }
                AppBarPanel.MoreButton.LabelForeground = new SolidColorBrush(Colors.White);
                AppBarMenuItemsPlaceholder.Foreground  = new SolidColorBrush(Colors.White);
            }

            OptimizeFullHD();

            _editButton.Click  += (sender, args) => ViewModel.Edit();
            _shareButton.Click += (sender, args) => ViewModel.Share();

            _reportMenuItem.Tap += (sender, args) =>
            {
                AppBarPanel.Close();
                Telegram.Api.Helpers.Execute.BeginOnUIThread(TimeSpan.FromSeconds(0.25), () =>
                {
                    ViewModel.Report();
                });
            };
            _addToGroupMenuItem.Tap += (sender, args) =>
            {
                AppBarPanel.Close();
                Telegram.Api.Helpers.Execute.BeginOnUIThread(TimeSpan.FromSeconds(0.25), () =>
                {
                    ViewModel.AddToGroup();
                });
            };
            _blockMenuItem.Tap += (sender, args) =>
            {
                AppBarPanel.Close();
                Telegram.Api.Helpers.Execute.BeginOnUIThread(TimeSpan.FromSeconds(0.25), () =>
                {
                    ViewModel.BlockContact();
                });
            };
            _unblockMenuItem.Tap += (sender, args) =>
            {
                AppBarPanel.Close();
                Telegram.Api.Helpers.Execute.BeginOnUIThread(TimeSpan.FromSeconds(0.25), () =>
                {
                    ViewModel.UnblockContact();
                });
            };
            _addMenuItem.Tap += (sender, args) =>
            {
                AppBarPanel.Close();
                Telegram.Api.Helpers.Execute.BeginOnUIThread(TimeSpan.FromSeconds(0.25), () =>
                {
                    ViewModel.AddContact();
                });
            };
            _deleteMenuItem.Tap += (sender, args) =>
            {
                AppBarPanel.Close();
                Telegram.Api.Helpers.Execute.BeginOnUIThread(TimeSpan.FromSeconds(0.25), () =>
                {
                    ViewModel.DeleteContact();
                });
            };

            Loaded += (sender, args) =>
            {
                _blockMenuItem.Content   = ViewModel.IsBot ? AppResources.StopBot : AppResources.BlockContact;
                _unblockMenuItem.Content = ViewModel.IsBot ? AppResources.RestartBot : AppResources.UnblockContact;

                if (ViewModel.ProfilePhotoViewer != null)
                {
                    ViewModel.ProfilePhotoViewer.PropertyChanged += OnProfileViewerPropertyChanged;
                }

                ViewModel.BlockedStatusChanged += OnBlockedStatusChanged;
                ViewModel.ImportStatusChanged  += OnImportStatusChanged;
                ViewModel.PropertyChanged      += OnContactDetailsPropertyChanges;

                BuildLocalizedAppBar();
            };

            Unloaded += (sender, args) =>
            {
                if (ViewModel.ProfilePhotoViewer != null)
                {
                    ViewModel.ProfilePhotoViewer.PropertyChanged -= OnProfileViewerPropertyChanged;
                }

                ViewModel.BlockedStatusChanged -= OnBlockedStatusChanged;
                ViewModel.ImportStatusChanged  -= OnImportStatusChanged;
                ViewModel.PropertyChanged      -= OnContactDetailsPropertyChanges;
            };
        }
Example #9
0
 private void MorePanelBackground_OnTap(object sender, GestureEventArgs e)
 {
     AppBarPanel.Close();
 }
Example #10
0
        public ChatView()
        {
            var timer = Stopwatch.StartNew();

            InitializeComponent();

            var isLightTheme = (Visibility)Application.Current.Resources["PhoneLightThemeVisibility"] == Visibility.Visible;

            if (isLightTheme)
            {
                NotificationsSwitch.Style            = (Style)Application.Current.Resources["ProfileLightToggleSwitch"];
                LayoutRoot.Background                = ShellView.CaptionBrush;
                AppBarPanel.MorePanelBackgroundBrush = ShellView.CaptionBrush;
                AppBarPanel.BackgroundBrush          = ShellView.CaptionBrush;

                _setPhotoButton.LabelForeground        = new SolidColorBrush(Colors.White);
                _editButton.LabelForeground            = new SolidColorBrush(Colors.White);
                _addButton.LabelForeground             = new SolidColorBrush(Colors.White);
                AppBarPanel.MoreButton.LabelForeground = new SolidColorBrush(Colors.White);
                AppBarMenuItemsPlaceholder.Foreground  = new SolidColorBrush(Colors.White);
            }

            OptimizeFullHD();

            _setPhotoButton.Tap += SetPhoto_OnTap;
            _editButton.Tap     += EditButton_OnTap;
            _addButton.Tap      += AddButton_OnTap;

            _deleteAndExitMenuItem.Tap += (sender, args) =>
            {
                AppBarPanel.Close();
                Telegram.Api.Helpers.Execute.BeginOnUIThread(TimeSpan.FromSeconds(0.25), () =>
                {
                    ViewModel.DeleteAndExitGroup();
                });
            };
            _setAdminsMenuItem.Tap += (sender, args) =>
            {
                AppBarPanel.Close();
                Telegram.Api.Helpers.Execute.BeginOnUIThread(TimeSpan.FromSeconds(0.25), () =>
                {
                    ViewModel.SetAdmins();
                });
            };
            _convertToSupergroupMenuItem.Tap += (sender, args) =>
            {
                AppBarPanel.Close();
                Telegram.Api.Helpers.Execute.BeginOnUIThread(TimeSpan.FromSeconds(0.25), () =>
                {
                    ViewModel.ConvertToSupergroup();
                });
            };

            Loaded += (sender, args) =>
            {
                if (ViewModel.ProfilePhotoViewer != null)
                {
                    ViewModel.ProfilePhotoViewer.PropertyChanged += OnProfileViewerPropertyChanged;
                }

                ViewModel.PropertyChanged += OnChatDetailsPropertyChanged;
                BuildLocalizedAppBar();
            };

            Unloaded += (sender, args) =>
            {
                ViewModel.PropertyChanged -= OnChatDetailsPropertyChanged;

                if (ViewModel.ProfilePhotoViewer != null)
                {
                    ViewModel.ProfilePhotoViewer.PropertyChanged -= OnProfileViewerPropertyChanged;
                }
            };
        }