コード例 #1
0
        private void OpenTabSettings(object sender, MouseButtonEventArgs e)
        {
            if (!(sender is FrameworkElement s))
            {
                return;
            }
            if (!(s.DataContext is HeaderedItemViewModel dc))
            {
                return;
            }
            var sw = new ChatSettingsWindow((Tab)dc.Content);

            sw.Show();
            sw.Activate();
        }
コード例 #2
0
        private void OpenTabSettings(object sender, MouseButtonEventArgs e)
        {
            if (!(sender is FrameworkElement s))
            {
                return;
            }
            if (!(s.DataContext is HeaderedItemViewModel dc))
            {
                return;
            }
            var tab = ((Tab)dc.Content);

            if (e.RightButton == MouseButtonState.Pressed)
            {
                var sw = new ChatSettingsWindow(tab);
                sw.Show();
                sw.Activate();
            }
            else if (e.MiddleButton == MouseButtonState.Pressed)
            {
                var currSel = TabControl.SelectedIndex;
                VM.RemoveTab(tab);
                UpdateSettings();


                if (VM.TabVMs.Count == 0)
                {
                    Close();
                    if (WindowSettings == null)
                    {
                        return;
                    }
                    App.Settings.ChatWindowsSettings.Remove((ChatWindowSettings)WindowSettings);
                }
                else
                {
                    TabControl.SelectedIndex = currSel == 0 ? 0 : currSel - 1;
                }
            }
            else
            {
                e.Handled = false;
            }
        }