예제 #1
0
        private void MenuItemTap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            FrameworkElement frameworkElement = sender as FrameworkElement;
            DependencyObject dependencyObject = (DependencyObject)frameworkElement;

            while (!(dependencyObject is ContextMenu))
            {
                dependencyObject = VisualTreeHelper.GetParent(dependencyObject);
            }
            ContextMenu contextMenu = dependencyObject as ContextMenu;
            int         num         = 0;

            contextMenu.IsOpen = num != 0;
            ConversationHeader dataContext1 = ((FrameworkElement)contextMenu).DataContext as ConversationHeader;

            if (!(frameworkElement.DataContext is MenuItemData))
            {
                return;
            }
            MenuItemData dataContext2 = frameworkElement.DataContext as MenuItemData;

            if (dataContext2.Tag == "delete" && MessageBox.Show(CommonResources.Conversation_ConfirmDeletion, CommonResources.Conversation_DeleteDialog, MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                ConversationsViewModel.Instance.DeleteConversation(dataContext1);
            }
            if (dataContext2.Tag == "disableEnable")
            {
                ConversationsViewModel.Instance.SetInProgressMain(true, "");
                dataContext1.DisableEnableNotifications((Action <bool>)(res => Execute.ExecuteOnUIThread((Action)(() =>
                {
                    ConversationsViewModel.Instance.SetInProgressMain(false, "");
                    if (res)
                    {
                        return;
                    }
                    ExtendedMessageBox.ShowSafe(CommonResources.Error);
                }))));
            }
            if (!(dataContext2.Tag == "messagesFromGroup") || dataContext1 == null)
            {
                return;
            }
            ConversationsViewModel.Instance.SetInProgressMain(true, "");
            dataContext1.AllowDenyMessagesFromGroup((Action <bool>)(res => Execute.ExecuteOnUIThread((Action)(() =>
            {
                ConversationsViewModel.Instance.SetInProgressMain(false, "");
                if (res)
                {
                    return;
                }
                ExtendedMessageBox.ShowSafe(CommonResources.Error);
            }))));
        }
예제 #2
0
        private void MenuItemTap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            FrameworkElement frameworkElement = sender as FrameworkElement;
            DependencyObject dependencyObject = (DependencyObject)frameworkElement;

            while (!(dependencyObject is ContextMenu))
            {
                dependencyObject = VisualTreeHelper.GetParent(dependencyObject);
            }
            ContextMenu contextMenu = dependencyObject as ContextMenu;
            int         num         = 0;

            contextMenu.IsOpen = num != 0;
            ConversationHeader dataContext1 = ((FrameworkElement)contextMenu).DataContext as ConversationHeader;

            if (!(frameworkElement.DataContext is MenuItemData))
            {
                return;
            }
            MenuItemData dataContext2 = frameworkElement.DataContext as MenuItemData;

            if (dataContext2.Tag == "delete")
            {
                this.DeleteConversation(dataContext1);
            }
            if (!(dataContext2.Tag == "disableEnable"))
            {
                return;
            }
            this.ConversationsVM.SetInProgressMain(true, "");
            dataContext1.DisableEnableNotifications((Action <bool>)(res => Execute.ExecuteOnUIThread((Action)(() =>
            {
                this.ConversationsVM.SetInProgressMain(false, "");
                if (res)
                {
                    return;
                }
                ExtendedMessageBox.ShowSafe(CommonResources.Error);
            }))));
        }