<commit_before>﻿using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using GW2PAO.API.Data.Enums;
using GW2PAO.Controllers.Interfaces;
using GW2PAO.PresentationCore;
using GW2PAO.ViewModels.DungeonTracker;
using GW2PAO.ViewModels.Interfaces;
using GW2PAO.ViewModels.WvWTracker;
using NLog;

namespace GW2PAO.Views.WvWTracker
{
    /// <summary>
    /// Interaction logic for WvWTrackerView.xaml
    /// </summary>
    public partial class WvWTrackerView : OverlayWindow
    {
        /// <summary>
        /// Default logger
        /// </summary>
        private static Logger logger = LogManager.GetCurrentClassLogger();

        // Vertical Orientation Size Constants:
        private const double VERTICAL_MIN_HEIGHT = 58;
        private const double VERTICAL_MAX_HEIGHT = 627;
        private const double VERTICAL_DEF_HEIGHT = 250;

        private const double VERTICAL_MIN_WIDTH = 125;
        private const double VERTICAL_MAX_WIDTH = 350;
        private const double VERTICAL_DEF_WIDTH = 182;

        // Horizontal Orientation Size Constants:
        private const double HORIZONTAL_MIN_HEIGHT = 76;
        private const double HORIZONTAL_MAX_HEIGHT = 125;

        private const double HORIZONTAL_MIN_WIDTH = 190;
        private const double HORIZONTAL_MAX_WIDTH = 1124;
        private const double HORIZONTAL_DEF_WIDTH = 350;

        /// <summary>
        /// Actual height of an objective in the list when in the horizontal orientation
        /// </summary>
        private double vertical_objHeight;

        /// <summary>
        /// Actual width of an objective in the list when in the horizontal orientation
        /// </summary>
        private double horizontal_objWidth;

        /// <summary>
        /// Height before collapsing the control
        /// </summary>
        private double beforeCollapseHeight;

        /// <summary>
        /// Count used for keeping track of when we need to adjust our
        /// maximum height/width if the number of visible objectives
        /// changes
        /// </summary>
        private int prevObjsCount = 0;

        /// <summary>
        /// WvW controller
        /// </summary>
        private IWvWController controller;

        /// <summary>
        /// WvW tracker view model
        /// </summary>
        private WvWTrackerViewModel viewModel;

        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="dungeonsController">The dungeons controller</param>
        public WvWTrackerView(IWvWController wvwController, IHasWvWMap mapVm)
        {
            logger.Debug("New WvWTrackerView created");
            this.controller = wvwController;
            this.viewModel = new WvWTrackerViewModel(this.controller, mapVm);
            this.DataContext = this.viewModel;
            InitializeComponent();

            this.vertical_objHeight = new HorizontalWvWObjectiveView().Height;
            this.horizontal_objWidth = new VerticalWvWObjectiveView().Width;

            this.Closing += WvWTrackerView_Closing;
            if (Properties.Settings.Default.WvWTrackerHeight > 0)
                this.Height = Properties.Settings.Default.WvWTrackerHeight;
            if (Properties.Settings.Default.WvWTrackerWidth > 0)
                this.Width = Properties.Settings.Default.WvWTrackerWidth;

            this.beforeCollapseHeight = this.Height;

            this.ResizeHelper.InitializeResizeElements(this.ResizeHeight, this.ResizeWidth);
            this.Loaded += (o, e) =>
                {
                    this.RefreshWindowHeights(false);
                    this.RefreshWindowWidths(false);
                    this.RefreshResizeSnapping();

                    // Set the window size and location
                    this.viewModel.PropertyChanged += viewModel_PropertyChanged;
                    this.ObjectivesContainer.LayoutUpdated += ObjectivesContainer_LayoutUpdated;
                };
        }

        /// <summary>
        /// Refreshes the resize snap increments, etc
        /// </summary>
        private void RefreshResizeSnapping()<commit_msg>Re-added previously removed size initialization in the constructor.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using GW2PAO.API.Data.Enums;
using GW2PAO.Controllers.Interfaces;
using GW2PAO.PresentationCore;
using GW2PAO.ViewModels.DungeonTracker;
using GW2PAO.ViewModels.Interfaces;
using GW2PAO.ViewModels.WvWTracker;
using NLog;

namespace GW2PAO.Views.WvWTracker
{
    /// <summary>
    /// Interaction logic for WvWTrackerView.xaml
    /// </summary>
    public partial class WvWTrackerView : OverlayWindow
    {
        /// <summary>
        /// Default logger
        /// </summary>
        private static Logger logger = LogManager.GetCurrentClassLogger();

        // Vertical Orientation Size Constants:
        private const double VERTICAL_MIN_HEIGHT = 58;
        private const double VERTICAL_MAX_HEIGHT = 627;
        private const double VERTICAL_DEF_HEIGHT = 250;

        private const double VERTICAL_MIN_WIDTH = 125;
        private const double VERTICAL_MAX_WIDTH = 350;
        private const double VERTICAL_DEF_WIDTH = 182;

        // Horizontal Orientation Size Constants:
        private const double HORIZONTAL_MIN_HEIGHT = 76;
        private const double HORIZONTAL_MAX_HEIGHT = 125;

        private const double HORIZONTAL_MIN_WIDTH = 190;
        private const double HORIZONTAL_MAX_WIDTH = 1124;
        private const double HORIZONTAL_DEF_WIDTH = 350;

        /// <summary>
        /// Actual height of an objective in the list when in the horizontal orientation
        /// </summary>
        private double vertical_objHeight;

        /// <summary>
        /// Actual width of an objective in the list when in the horizontal orientation
        /// </summary>
        private double horizontal_objWidth;

        /// <summary>
        /// Height before collapsing the control
        /// </summary>
        private double beforeCollapseHeight;

        /// <summary>
        /// Count used for keeping track of when we need to adjust our
        /// maximum height/width if the number of visible objectives
        /// changes
        /// </summary>
        private int prevObjsCount = 0;

        /// <summary>
        /// WvW controller
        /// </summary>
        private IWvWController controller;

        /// <summary>
        /// WvW tracker view model
        /// </summary>
        private WvWTrackerViewModel viewModel;

        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="dungeonsController">The dungeons controller</param>
        public WvWTrackerView(IWvWController wvwController, IHasWvWMap mapVm)
        {
            logger.Debug("New WvWTrackerView created");
            this.controller = wvwController;
            this.viewModel = new WvWTrackerViewModel(this.controller, mapVm);
            this.DataContext = this.viewModel;
            InitializeComponent();

            this.Closing += WvWTrackerView_Closing;

            this.vertical_objHeight = new HorizontalWvWObjectiveView().Height;
            this.horizontal_objWidth = new VerticalWvWObjectiveView().Width;

            // Set initial height and widths
            if (this.viewModel.IsHorizontalOrientation)
            {
                // Horizontal Orientation
                this.MinHeight = HORIZONTAL_MIN_HEIGHT;
                this.MaxHeight = HORIZONTAL_MAX_HEIGHT;
                this.Height = this.MaxHeight;
                this.MinWidth = HORIZONTAL_MIN_WIDTH;
                this.MaxWidth = HORIZONTAL_MAX_WIDTH;
                this.Width = HORIZONTAL_DEF_WIDTH;
            }
            else
            {
                // Vertical Orientation
                this.MinHeight = VERTICAL_MIN_HEIGHT;
                this.MaxHeight = VERTICAL_MAX_HEIGHT;
                this.Height = VERTICAL_MAX_HEIGHT / 3;
                this.MinWidth = VERTICAL_MIN_WIDTH;
                this.MaxWidth = VERTICAL_MAX_WIDTH;
                this.Width = VERTICAL_DEF_WIDTH;
            }

            if (Properties.Settings.Default.WvWTrackerHeight > 0)
                this.Height = Properties.Settings.Default.WvWTrackerHeight;
            if (Properties.Settings.Default.WvWTrackerWidth > 0)
                this.Width = Properties.Settings.Default.WvWTrackerWidth;

            this.beforeCollapseHeight = this.Height;

            this.ResizeHelper.InitializeResizeElements(this.ResizeHeight, this.ResizeWidth);
            this.Loaded += (o, e) =>
                {
                    this.RefreshWindowHeights(false);
                    this.RefreshWindowWidths(false);
                    this.RefreshResizeSnapping();

                    // Set the window size and location
                    this.viewModel.PropertyChanged += viewModel_PropertyChanged;
                    this.ObjectivesContainer.LayoutUpdated += ObjectivesContainer_LayoutUpdated;
                };
        }

        /// <summary>
        /// Refreshes the resize snap increments, etc
        /// </summary>
        private void RefreshResizeSnapping()
{'fraction_non_alphanumeric': 0.08349455248956318, 'fraction_numerical': 0.008654923123918135, 'mean_word_length': 2.1370169274992015, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4432352', 'n_tokens_mistral': 2715, 'n_tokens_neox': 2545, 'n_words': 623}