<commit_before>﻿using Stylet;
using SyncTrayzor.SyncThing;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SyncTrayzor.NotifyIcon
{
    public class NotifyIconViewModel : PropertyChangedBase
    {
        private readonly ISyncThingManager syncThingManager;

        public bool Visible { get; set; }
        public bool MainWindowVisible { get; set; }

        public event EventHandler WindowOpenRequested;
        public event EventHandler WindowCloseRequested;
        public event EventHandler ExitRequested;

        public SyncThingState SyncThingState { get; set; }

        public bool SyncThingStarted
        {
            get { return this.SyncThingState != SyncThingState.Stopped; }
        }

        public bool SyncThingSyncing { get; private set; }

        public NotifyIconViewModel(ISyncThingManager syncThingManager)
        {
            this.syncThingManager = syncThingManager;

            this.syncThingManager.StateChanged += (o, e) => this.SyncThingState = e.NewState;
            this.SyncThingState = this.syncThingManager.State;

            this.syncThingManager.TotalConnectionStatsChanged += (o, e) =>
            {
                var stats = e.TotalConnectionStats;
                this.SyncThingSyncing = stats.InBytesPerSecond > 0 || stats.OutBytesPerSecond > 0;
            };
        }

        public void DoubleClick()
        {
            this.OnWindowOpenRequested();
        }

        public void Restore()
        {
            this.OnWindowOpenRequested();
        }

        public void Minimize()
        {
            this.OnWindowCloseRequested();
        }<commit_msg>Make sure we're not marked as 'syncing' when we're stopped...<commit_after>﻿using Stylet;
using SyncTrayzor.SyncThing;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SyncTrayzor.NotifyIcon
{
    public class NotifyIconViewModel : PropertyChangedBase
    {
        private readonly ISyncThingManager syncThingManager;

        public bool Visible { get; set; }
        public bool MainWindowVisible { get; set; }

        public event EventHandler WindowOpenRequested;
        public event EventHandler WindowCloseRequested;
        public event EventHandler ExitRequested;

        public SyncThingState SyncThingState { get; set; }

        public bool SyncThingStarted
        {
            get { return this.SyncThingState != SyncThingState.Stopped; }
        }

        public bool SyncThingSyncing { get; private set; }

        public NotifyIconViewModel(ISyncThingManager syncThingManager)
        {
            this.syncThingManager = syncThingManager;

            this.syncThingManager.StateChanged += (o, e) =>
            {
                this.SyncThingState = e.NewState;
                if (e.NewState != SyncThingState.Running)
                    this.SyncThingSyncing = false; // Just make sure we reset this...
            };
            this.SyncThingState = this.syncThingManager.State;

            this.syncThingManager.TotalConnectionStatsChanged += (o, e) =>
            {
                var stats = e.TotalConnectionStats;
                this.SyncThingSyncing = stats.InBytesPerSecond > 0 || stats.OutBytesPerSecond > 0;
            };
        }

        public void DoubleClick()
        {
            this.OnWindowOpenRequested();
        }

        public void Restore()
        {
            this.OnWindowOpenRequested();
        }

        public void Minimize()
        {
            this.OnWindowCloseRequested();
        }
{'fraction_non_alphanumeric': 0.074745809288266, 'fraction_numerical': 0.0010992030777686177, 'mean_word_length': 2.1624674196351, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '3394779', 'n_tokens_mistral': 1010, 'n_tokens_neox': 967, 'n_words': 218}