Ejemplo n.º 1
0
        public async void Update()
        {
            try
            {
                var metroWindow = (Application.Current.MainWindow as MetroWindow);

                _manager.UpdateQueue(Instance);

                await metroWindow.ShowMessageAsync("Updating", "Success");
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Update failed", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Ejemplo n.º 2
0
        private async Task CopyQueues(ProgressDialogController controller)
        {
            var queuesToUpdate = _fromManager.Queues.Where(a => _toManager.Queues.Select(b => b.Path).Contains(a.Path)).ToList();

            foreach (var queue in queuesToUpdate)
            {
                controller.SetMessage(string.Format("Updating: {0}", queue.Path));
                await Task.Run(() =>
                {
                    _toManager.UpdateQueue(queue);
                });
            }

            var queuesToAdd = _fromManager.Queues.Except(_toManager.Queues, new LambdaComparer <QueueDescription>((a, b) => a.Path == b.Path, a => 1)).ToList();

            foreach (var queue in queuesToAdd)
            {
                controller.SetMessage(string.Format("Adding: {0}", queue.Path));
                await Task.Run(() =>
                {
                    _toManager.CreateQueue(queue);
                });
            }
        }