Exemplo n.º 1
0
        public async void NewButton()
        {
            MetroWindow         appWindow = (System.Windows.Application.Current.MainWindow as MetroWindow);
            MessageDialogResult result    = await appWindow.ShowMessageAsync("Confirm", "Are you sure you want to create a new file?", MessageDialogStyle.AffirmativeAndNegative);

            if (result.ToString() == "Affirmative")
            {
                _eventAggregator.BeginPublishOnUIThread(new EventAggregators.SendMessage("newFile", null));
            }
        }
Exemplo n.º 2
0
 public void ShowDetails()
 {
     if (ActiveItem != null)
     {
         var message = new OpenWindow <T>(ActiveItem.Item);
         eventAggregator.BeginPublishOnUIThread(message);
     }
 }
        public Result ImportDataFromText(CollectionReference collection, string textData)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(textData))
                {
                    return(Result.Ok());
                }

                var newValue = JsonSerializer.Deserialize(textData);
                var newDocs  = new List <BsonDocument>();
                if (newValue.IsArray)
                {
                    foreach (var value in newValue.AsArray)
                    {
                        var doc = value.AsDocument;
                        collection.AddItem(doc);
                        newDocs.Add(doc);
                    }
                }
                else
                {
                    var doc = newValue.AsDocument;
                    collection.AddItem(doc);
                    newDocs.Add(doc);
                }

                _eventAggregator.BeginPublishOnUIThread(new InteractionEvents.DocumentsUpdated(nameof(ImportDataFromText), newDocs));
            }
            catch (Exception e)
            {
                var message = "Failed to import document from text content: " + e.Message;
                Logger.Warn(e, "Cannot process clipboard data.");
                ErrorInteraction(message, "Import Error");
                return(Result.Fail(message));
            }

            return(Result.Ok());
        }
Exemplo n.º 4
0
        public void Handle(ShowActivatedFeatureWindowMessage message)
        {
            if (message.ShowWindow && ActivatedFeatureVm == null)
            {
                ActivatedFeatureVm = new ActivatedFeatureViewModel(eventAggregator, repository);
                var resendSelectedDefinition = new ResendItemSelectedRequest <FeatureDefinition>();
                eventAggregator.BeginPublishOnUIThread(resendSelectedDefinition);
            }

            if (!message.ShowWindow && ActivatedFeatureVm != null)
            {
                ActivatedFeatureVm = null;
            }
        }
Exemplo n.º 5
0
        private void CreateFilterChangeEvent()
        {
            _logger.Info($"Raising event with new filters data.");

            AlarmManagentListFiltersEventMessage message = new AlarmManagentListFiltersEventMessage()
            {
                AlarmTagNameFilter       = AlmTagNameFilter,
                AckTagNameFilter         = AckTagNameFilter,
                AlarmProfileFilter       = AlarmProfileFIlter,
                SMSrecipientsGroupFilter = SmsGroupFilter,
                AlarmTagAddressFilter    = AlmAddressFilter,
            };

            _eventAggregator.BeginPublishOnUIThread(message);
        }
Exemplo n.º 6
0
        public async Task LogIn()
        {
            try
            {
                ErrorMessage = "";
                var result = await _apiHelper.Authenticate(UserName, Password);

                await _apiHelper.GetLoggedInUserInfo(result.Access_Token);

                _events.BeginPublishOnUIThread(new LogOnEvent());
            }
            catch (Exception ex)
            {
                ErrorMessage = ex.Message;
            }
        }
Exemplo n.º 7
0
 public void AESubmit()
 {
     if (AEFunction == "Edit")
     {
         SelectedXMLSoftware.Id        = AEID;
         SelectedXMLSoftware.IncludeID = AEIncludeID;
         SelectedXMLSoftware.Label     = AELabel;
         if (AEType)
         {
             (SelectedXMLSoftware as Application).Name = AEName;
         }
         else
         {
             (SelectedXMLSoftware as Package).PkgId       = AEPkgID;
             (SelectedXMLSoftware as Package).ProgramName = AEProgramName;
         }
     }
     else
     {
         if (AEType)
         {
             Application app = new Application()
             {
                 Id        = AEID,
                 IncludeID = AEIncludeID,
                 Label     = AELabel,
                 Name      = AEName
             };
             XMLSoftware.Add(app);
         }
         else
         {
             Package pkg = new Package()
             {
                 Id          = AEID,
                 IncludeID   = AEIncludeID,
                 Label       = AELabel,
                 PkgId       = AEPkgID,
                 ProgramName = AEProgramName
             };
             XMLSoftware.Add(pkg);
         }
     }
     CanToggleType  = true;
     AddVisibleBool = false;
     eventAggregator.BeginPublishOnUIThread(new EventAggregators.ChangeUI("SoftwareChange", null));
 }
Exemplo n.º 8
0
        public void ChangeLanguage(string language)
        {
            CultureInfo culture = new CultureInfo(language);

            Thread.CurrentThread.CurrentCulture   = culture;
            Thread.CurrentThread.CurrentUICulture = culture;

            Resources.Apply(item => item.CurrentCulture = culture);

            IEventAggregator eventAggregator = IoC.Get <IEventAggregator>();

            eventAggregator.BeginPublishOnUIThread(new LanguageChangedMessage());

            if (LanguageChanged != null)
            {
                LanguageChanged(this, null);
            }
        }
Exemplo n.º 9
0
        public MainWindowViewModel(
            PodcastViewModel podcastView, IDataStorage storage, IEventAggregator eventAggregator, DetailViewModel detailViewModel)
        {
            _detailViewModel = detailViewModel;
            //Set Title
            base.DisplayName = "CastGetter - Enjoy podcasts the easy way :-)";
            _eventAggregator = eventAggregator;
            //Set currentView
            ActivateItem(podcastView);
            //Get data from data storage
            var casts = storage.GetAllCasts();

            //if data storage contain podcasts populate Views -> with Data
            if (casts != null)
            {
                foreach (var cast in casts)
                {
                    _eventAggregator.BeginPublishOnUIThread(cast);
                }
            }
            _eventAggregator.Subscribe(this);
        }
 public SinglePlayerViewModel(IEventAggregator eventAggregator)
 {
     eventAggregator.BeginPublishOnUIThread(new ChangeMenuConfigMessage { MenuConfig = _menuConfig.Value });
 }
 public void ClosePanel()
 {
     _eventAggregator.BeginPublishOnUIThread(new ToolSetPanelActionRequest(ToolSetPanelAction.Close));
 }
 public void GoToThePage1()
 {
     _logService.Log($"Execution GoToThePage1");
     _eventAggregator.BeginPublishOnUIThread(new NavigateToScreen1Event());
 }