public string OpenFromID(string contentID) { if (!string.IsNullOrWhiteSpace(contentID)) { _container.Resolve <IStateService>().AddToRecentAndSetCurrent(contentID); IFileHistoryService serv = _container.Resolve <IFileHistoryService>(); if (serv.AddToRecent(contentID)) { serv.UpdateStorage().ContinueWith(prevTask => { var exc = prevTask.Exception.Flatten().InnerException; _container.Resolve <Core.Infrastructure.Base.ILogger>() .Log(Core.Infrastructure.Base.LogSeverity.Error, exc.Message, exc); prevTask.Dispose(); }, System.Threading.Tasks.TaskContinuationOptions.NotOnRanToCompletion); } DocumentLoadingEvent openValue = new DocumentLoadingEvent() { Path = contentID }; _eventAggregator.GetEvent <DocumentLoadingEvent>().Publish(openValue); return(contentID); } return(string.Empty); }
public SOSFileUploader(SOSFileUploaderOptions options, SOSApiClient sosApiClient, IFileHistoryService fileHistoryService, ISOSFileParserService sosFileParser) { _log = Log.ForContext <SOSFileUploader>(); _qsrPath = options.QsrSOSPath; _fileHistoryService = fileHistoryService; _sosApiClient = sosApiClient; _store = _sosApiClient.GetStoreAsync(options.StoreId).Result; _sosFileParser = sosFileParser; }
public RecentMenuItemViewModel(string header, int priority, IUnityContainer container = null, ImageSource icon = null, ICommand command = null, KeyGesture gesture = null, bool isCheckable = false) : base(header, priority, icon, command, gesture, isCheckable) { if (container != null) { _containerWeak = new GenericWeakReference <IUnityContainer>(container); IFileHistoryService service = _containerWeak.Get().Resolve <IFileHistoryService>(); if (service != null) { _historyServWeak = new GenericWeakReference <IFileHistoryService>(service); _historyServWeak.Get().RecentChanged += RecentMenuItemViewModel_RecentChanged; } } }
public string Open(object location = null) { OpenFileDialog dialog = new OpenFileDialog(); bool? result = false; if (location == null) { result = dialog.ShowDialog(); location = dialog.FileName; } else { result = true; } if (result == true && !string.IsNullOrWhiteSpace(location.ToString())) { string loc = location.ToString(); _container.Resolve <IStateService>().AddToRecentAndSetCurrent(loc); IFileHistoryService serv = _container.Resolve <IFileHistoryService>(); if (serv.AddToRecent(loc)) { serv.UpdateStorage().ContinueWith(prevTask => { var exc = prevTask.Exception.Flatten().InnerException; _container.Resolve <Core.Infrastructure.Base.ILogger>() .Log(Core.Infrastructure.Base.LogSeverity.Error, exc.Message, exc); prevTask.Dispose(); }, System.Threading.Tasks.TaskContinuationOptions.NotOnRanToCompletion); } DocumentLoadingEvent openValue = new DocumentLoadingEvent() { Path = loc }; _eventAggregator.GetEvent <DocumentLoadingEvent>().Publish(openValue); return(loc); } return(string.Empty); }