Beispiel #1
0
        public Sentinel()
        {
            league.OnConnected      += HandleConnect;
            league.OnDisconnected   += HandleDisconnect;
            league.OnWebsocketEvent += PotentiallyHandleNewMessage;

            league.Observe("/lol-lobby/v2/received-invitations", HandleInviteUpdate);
            league.Observe("/lol-chat/v1/conversations/active", HandleActiveConversationUpdate);
            league.Observe("/lol-gameflow/v1/session", HandleGameflowUpdate);
            league.Observe("/lol-summoner/v1/current-summoner", summ => summonerId = summ != null ? summ["summonerId"] : -1);

            // This will do nothing if the directory already exists.
            Directory.CreateDirectory(StorageDir);

            // Load settings, or use defaults if they don't exist.
            if (!File.Exists(SettingsPath))
            {
                settings = new SentinelSettings();
            }
            else
            {
                using (Stream stream = File.Open(SettingsPath, FileMode.Open))
                {
                    var binaryFormatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
                    settings = (SentinelSettings)binaryFormatter.Deserialize(stream);
                }
            }
        }
        public AboutWindow(SentinelSettings settings)
        {
            InitializeComponent();

            Settings    = settings;
            Logo.Source = Imaging.CreateBitmapSourceFromHIcon(sentinel_icon.Handle, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());

            AllChatsCheckbox.IsChecked = Settings.ShowAllConversations;
            InGameCheckbox.IsChecked   = Settings.ShowWhileIngame;

            AllChatsCheckbox.Click += (a, b) =>
            {
                Settings.ShowAllConversations = AllChatsCheckbox.IsChecked.Value;
                WriteSettings();
            };

            InGameCheckbox.Click += (a, b) =>
            {
                Settings.ShowWhileIngame = InGameCheckbox.IsChecked.Value;
                WriteSettings();
            };
        }