Exemple #1
0
 public void ChangeLayout(LayoutType type)
 {
     _currentLayout = type;
     foreach (var mapping in _inputData.Layouts[(int)_currentLayout].Mappings)
     {
         _directionEntries[mapping.MoveDir].UpdateKey(mapping.KeyCode);
     }
     OnLayoutChanged?.Invoke(_currentLayout);
 }
Exemple #2
0
 void FoldLayoutChanged()
 {
     OnLayoutChanged?.Invoke(this, new Microsoft.Maui.Foldable.FoldEventArgs()
     {
         isSeparating         = IsSeparating,
         FoldingFeatureBounds = FoldingFeatureBounds,
         WindowBounds         = WindowBounds
     });
 }
Exemple #3
0
        public async Task Start()
        {
            _client = new HttpClient();

            var stream = await _client.GetStreamAsync(Host);

            var reader = new StreamReader(stream);

            string eventName = null;
            string data      = null;

            while (_client != null)
            {
                var line = await reader.ReadLineAsync();


                if (string.IsNullOrEmpty(line) || line.StartsWith(":"))
                {
                    eventName = data = null;
                    continue;
                }

                if (line.StartsWith("event: "))
                {
                    eventName = line.Substring("event: ".Length).Trim();
                }
                else if (line.StartsWith("data: "))
                {
                    data = line.Substring("data: ".Length).Trim('"');

                    switch (eventName)
                    {
                    case "data_changed":
                        OnDataChanged?.Invoke(JsonConvert.DeserializeObject <JToken>(data));
                        break;

                    case "layout_changed":
                        OnLayoutChanged?.Invoke(data);
                        break;
                    }
                }
            }
            this.Stop();
        }