Пример #1
0
        private async void OnEnviromentDocumentSaved(object sender, DevEnviromentDocument e)
        {
            var documentExtension = Path.GetExtension(e.Path);

            try
            {
                if (documentExtension != null)
                {
                    switch (documentExtension.ToLowerInvariant())
                    {
                    case ".xaml":
                    {
                        await _clientsHolder.UpdateXamlAsync(e.Content);

                        break;
                    }

                    case ".css":
                    {
                        await _clientsHolder.UpdateCssAsync(e.Path);

                        break;
                    }
                    }
                }
            }
            catch (AggregateException)
            {
                _logger.Log($"{TextResources.Update_Failed_Message} {TextResources.Device_Offline_Message}");
            }
        }
Пример #2
0
        private async void OnEnviromentDocumentSaved(object sender, DevEnviromentDocument e)
        {
            var documentExtension = Path.GetExtension(e.Path);

            try
            {
                if (_supportedResourceExtensions.Contains(documentExtension.ToLowerInvariant()))
                {
                    await _clientsHolder.UpdateResourceAsync(e.Path, e.Content);
                }
            }
            catch (AggregateException)
            {
                _logger.Log($"{TextResources.Update_Failed_Message} {TextResources.Device_Offline_Message}");
            }
        }
Пример #3
0
        private async void OnEnviromentDocumentSaved(object sender, DevEnviromentDocument e)
        {
            var documentExtension = Path.GetExtension(e.Path)?.ToLowerInvariant();

            try
            {
                if (_supportedResourceExtensions.Contains(documentExtension))
                {
                    if (string.IsNullOrWhiteSpace(e.Content) && File.Exists(e.Path))
                    {
                        e.Content = File.ReadAllText(e.Path);
                    }
                    await _clientsHolder.UpdateResourceAsync(e.Path, e.Content);
                }
            }
            catch (AggregateException)
            {
                _logger.Log($"{TextResources.Update_Failed_Message} {TextResources.Device_Offline_Message}");
            }
            catch
            {
                _logger.Log($"{TextResources.Update_Failed_Message} {TextResources.Unknown_Error}");
            }
        }
        public void OnDocumentSaved(SavedDocument document)
        {
            var doc = new DevEnviromentDocument(document.FilePath, new string(document.Content));

            OnDocumentSaved(doc);
        }
Пример #5
0
 protected virtual void OnDocumentSaved(DevEnviromentDocument e)
 {
     DocumentSaved?.Invoke(this, e);
 }