Exemple #1
0
        /// <summary>
        /// Initializes the application.
        /// </summary>
        public App()
        {
            viewModel = new AppViewModel ();
            viewModel.PropertyChanged += OnPropertyChanged;

            SetPage(new MainView { BindingContext = viewModel });
        }
 public RootConfigViewModel( AppViewModel app )
     : base(app.ConfigManager)
 {
     DisplayName = Resources.R.Home;
     _app = app;
     _autoclicId = new Guid( "{989BE0E6-D710-489e-918F-FBB8700E2BB2}" );
     _skinId = new Guid( "{36C4764A-111C-45e4-83D6-E38FC1DF5979}" );
     _basicScrollId = new Guid( "{84DF23DC-C95A-40ED-9F60-F39CD350E79A}" );
 }
        public SkinViewModel( AppViewModel app )
            : base("{36C4764A-111C-45e4-83D6-E38FC1DF5979}", R.SkinConfig, app)
        {
            _app = app;

            _action = () =>
            {
                NotifyOfPropertyChange( () => EnableAutoHide );
                NotifyOfPropertyChange( () => AutoHideTimeOut );
            };
        }
        public ContextModel( AppViewModel app )
        {
            _app = app;
            _ctx = app.KeyboardContext;

            _keyboards = new ObservableCollection<KeyboardModel>();
            foreach( IKeyboard keyboard in _ctx.Keyboards )
            {
                _keyboards.Add( new KeyboardModel( keyboard ) );
            }

            RegisterEvents();
        }
Exemple #5
0
        public ConfigBase( string editedPluginId, string displayName, AppViewModel app )
            : base(app.ConfigManager)
        {
            DisplayName = displayName;

            _editedPluginId = new Guid( editedPluginId );
            _app = app;
            _app.ConfigContainer.Changed += new EventHandler<ConfigChangedEventArgs>( OnConfigChangedWrapper );
            _app.PluginRunner.PluginHost.StatusChanged += ( o, e ) =>
            {
                if( e.PluginProxy.PluginKey.PluginId == _editedPluginId && _plugin == null )
                {
                    InitializePlugin();
                }

                NotifyOfPropertiesChange();
            };
        }
        public SkinBasicConfigViewModel( AppViewModel app )
            : base(app.ConfigManager)
        {
            DisplayName = R.SkinBasicConfig;
            _app = app;
            _app.PluginRunner.PluginHost.StatusChanged += ( o, e ) =>
            {
                if( e.PluginProxy.PluginKey.PluginId == _skinId && _skinPlugin == null )
                {
                    _skinPlugin = _app.PluginRunner.PluginHost.FindLoadedPlugin( _skinId, true );
                    _config = _app.ConfigContainer.GetObjectPluginConfig( _app.CivikeyHost.Context.ConfigManager.UserConfiguration, _skinPlugin );
                }

                NotifyOfPropertyChange( () => ActivateSkin );
                NotifyOfPropertyChange( () => EnableAutoHide );
                NotifyOfPropertyChange( () => AutoHideTimeOut );
            };
        }
            public void TestSample()
            {
                var serviceProvider = CreateServiceProvider();
                var appViewModel = new AppViewModel(serviceProvider);

                MainPageViewModel viewModel = null;
                var action = Execute.OnUIThread(() =>
                {
                    viewModel = new MainPageViewModel(serviceProvider, appViewModel);
                });
                Eventually.ShouldBecomeTrue(() => viewModel != null, DefaultTimeout);

                Eventually.ShouldBecomeTrue(() => viewModel.ConnectionInfo != null, DefaultTimeout);
                viewModel.ConnectionInfoTaskStatus.ShouldEqual(TaskStatus.RanToCompletion);
                viewModel.ConnectionInfo.Address.ToString().ShouldEqual("22.33.44.55");
                viewModel.ConnectionInfo.Network.ToString().ShouldEqual("22.33.44.0/24");

                Eventually.ShouldBecomeTrue(() => viewModel.DhcpInfo != null, DefaultTimeout);
                viewModel.DhcpInfoTaskStatus.ShouldEqual(TaskStatus.RanToCompletion);
                viewModel.DhcpInfo.GatewayAddress.ToString().ShouldEqual("100.101.102.103");
                viewModel.DhcpInfo.DnsServerAddress.ToString().ShouldEqual("200.201.202.203");
                viewModel.DhcpInfo.DomainName.ShouldEqual("my-domain-name");

                Eventually.ShouldBecomeTrue(() => viewModel.ExternalAddress != null, DefaultTimeout);
                viewModel.ExternalAddressTaskStatus.ShouldEqual(TaskStatus.RanToCompletion);
                viewModel.ExternalAddress.ToString().ShouldEqual("50.51.52.53");

                Eventually.ShouldBecomeTrue(() => viewModel.ScanCommand.CanExecute(null), DefaultTimeout);
                Eventually.ShouldBecomeFalse(() => viewModel.CancelScanCommand.CanExecute(null), DefaultTimeout);
                Eventually.ShouldBecomeTrue(() => viewModel.ShowServicesCommand.CanExecute(null), DefaultTimeout);

                viewModel.AvailableServices.ShouldBeEmpty();
                viewModel.ProgressPercent.ShouldEqual(0.0d);
                viewModel.Status.ShouldEqual(String.Empty);

                viewModel.CustomSelectionCommands.Count.ShouldEqual(1);
                viewModel.CustomSelectionCommands.First().Label.ShouldEqual("select whole network");

                viewModel.StartAddressValue.ShouldEqual(IPAddress.Parse("22.33.44.01").Value);
                viewModel.IsStartAddressValid.ShouldBeTrue();
                viewModel.EndAddressValue.ShouldEqual(IPAddress.Parse("22.33.44.254").Value);
                viewModel.IsEndAddressValid.ShouldBeTrue();
            }
        public WordPredictionViewModel( AppViewModel app )
            : base("{4DC42B82-4B29-4896-A548-3086AA9421D7}", R.WordPredictionConfig, app)
        {
            _app = app;
            _wordPredictionPlugins = new List<IPluginProxy>();
            _wordPredictionPluginIds = new List<Guid>();

            _wordPredictionPluginIds.Add( new Guid( "{1756C34D-EF4F-45DA-9224-1232E96964D2}" ) );
            _wordPredictionPluginIds.Add( new Guid( "{1764F522-A9E9-40E5-B821-25E12D10DC65}" ) );
            _wordPredictionPluginIds.Add( new Guid( "{669622D4-4E7E-4CCE-96B1-6189DC5CD5D6}" ) );
            _wordPredictionPluginIds.Add( new Guid( "{4DC42B82-4B29-4896-A548-3086AA9421D7}" ) );
            _wordPredictionPluginIds.Add( new Guid( "{8789CDCC-A7BB-46E5-B119-28DC48C9A8B3}" ) );
            _wordPredictionPluginIds.Add( new Guid( "{69E910CC-C51B-4B80-86D3-E86B6C668C61}" ) );
            _wordPredictionPluginIds.Add( new Guid( "{86777945-654D-4A56-B301-5E92B498A685}" ) );
            _wordPredictionPluginIds.Add( new Guid( "{B2A76BF2-E9D2-4B0B-ABD4-270958E17DA0}" ) );
            _wordPredictionPluginIds.Add( new Guid( "{55C2A080-30EB-4CC6-B602-FCBBF97C8BA5}" ) );

            GetPlugins();
        }
        public ConfigBase( string editedPluginId, string displayName, AppViewModel app )
            : base(app.ConfigManager)
        {
            DisplayName = displayName;

            _editedPluginId = new Guid( editedPluginId );
            _app = app;
            _app.ConfigContainer.Changed += new EventHandler<ConfigChangedEventArgs>( OnConfigChangedWrapper );

            InitializePlugin();

            _app.PluginRunner.ApplyDone += ( o, e ) =>
            {
                if( _pluginInfo == null || _plugin == null )
                {
                    InitializePlugin();
                }
            };
        }
Exemple #10
0
        public AppViewModel CreateApp(AppViewModel viewModel, AppData appData)
        {
            WebRequest request = PrepearRequest("POST", null);

            using (var streamWriter = new StreamWriter(request.GetRequestStream()))
            {
                string jsonString = JsonConvert.SerializeObject(appData);
                streamWriter.Write(jsonString);
            }

            var     json          = GetJson(request);
            AppData appDataResult = JsonConvert.DeserializeObject <AppData>(json);

            viewModel.AppDataList = new List <AppData>();
            viewModel.AppDataList.Add(appDataResult);

            viewModel.SuccessMessage = "A new app is now created";

            return(viewModel);
        }
Exemple #11
0
        private async Task <bool> RemoveDebuffs(AppViewModel app)
        {
            if (await RemoveParalysisFromPlayers(app) ||
                await RemoveMaxHpMpDownFromPlayers(app) ||
                await RemoveDefenseDownFromPlayers(app) ||
                await RemoveMagicDefenseDownFromPlayers(app) ||
                await RemoveSlowFromPlayers(app) ||
                await RemovePlagueFromPlayers(app) ||
                await RemoveParalysisFromPlayers(app) ||
                await RemoveBlindPoisonFromPlayers(app) ||
                await RemoveGravityBindFromPlayers(app) ||
                await RemoveHelixBioDiaFromPlayers(app) ||
                await RemoveAmnesiaFromPlayers(app) ||
                await RemoveStatDownFromPlayers(app))
            {
                return(true);
            }

            return(false);
        }
Exemple #12
0
        public App()
        {
            this.InitializeComponent();

            CustomXamlResourceLoader.Current = new CustomResourceLoader();
            this.Suspending    += OnSuspending;
            UnhandledException += OnUnhandleException;
            EnteredBackground  += App_EnteredBackground;
            LeavingBackground  += App_LeavingBackground;
            App.AppViewModel    = new AppViewModel();
            App.BiliViewModel   = new BiliViewModel();
            bool isThemeWithSystem = AppTool.GetBoolSetting(Settings.IsThemeWithSystem);

            _isTabletMode = AppTool.GetLocalSetting(Settings.DisplayMode, "") == "Tablet";
            if (!isThemeWithSystem)
            {
                string theme = AppTool.GetLocalSetting(Settings.Theme, "Light");
                RequestedTheme = theme == "Light" ? ApplicationTheme.Light : ApplicationTheme.Dark;
            }
        }
        public IActionResult History(int id)
        {
            Passwd toEdit = _db.Passwds.Where(a => a.Id == id).FirstOrDefault(); // get password to decrypt by id
            User   usr    = Functions.getUser(_cache);

            if (toEdit.UserId != usr.Id)
            {
                _cache.Set(CacheNames.error4, "You can't check history");
                return(RedirectToAction("Index"));
            }

            AppViewModel appViewModel = new AppViewModel
            {
                User   = Functions.getUser(_cache),
                Logged = Functions.getLogged(_cache),
                Passwd = toEdit
            };

            return(View(appViewModel));
        }
        public void TestCreate()
        {
            var ass    = new Mock <IAstroService>().Object;
            var ds     = new Mock <IDialogService>().Object;
            var rsMock = new Mock <IResolverService>();

            rsMock
            .Setup(p => p.CreateViewModel <NatalChartViewModel>())
            .Returns(() => new NatalChartViewModel(new Mock <IFileService>().Object, new Mock <ITimeZoneProvider>().Object, ass));
            var rs        = rsMock.Object;
            var viewmodel = new AppViewModel(ass, ds, rs);

            Assert.Same(ass, viewmodel.AstroService);
            Assert.Same(ds, viewmodel.DialogService);
            Assert.NotNull(viewmodel.CurrentNatalChart);

            Assert.Throws <ArgumentNullException>(() => new AppViewModel(null, ds, rs));
            Assert.Throws <ArgumentNullException>(() => new AppViewModel(ass, null, rs));
            Assert.Throws <ArgumentNullException>(() => new AppViewModel(ass, ds, null));
        }
 private async Task <bool> DoGeomancyStuff(AppViewModel app)
 {
     if (await UseFullCircle(app))
     {
         return(true);
     }
     if (await CastIndiSpell(app))
     {
         return(true);
     }
     if (await CastEntrustIndiSpell(app))
     {
         return(true);
     }
     if (await CastGeoSpell(app))
     {
         return(true);
     }
     return(false);
 }
Exemple #16
0
        public AppLocationView(AppViewModel appViewModel,
                               ObservableCollection <Forest> validForests)
        {
            InitializeComponent();

            AppViewModel = appViewModel;

            _forestButtons = new Dictionary <string, ForestButton>();

            if (AppViewModel.ServicesViewModel.SelectedAppServiceTag == "nest-oak")
            {
                SetupOakLocations(validForests);
            }
            else
            {
                SetupRedbudLocations(validForests);
            }

            ButtonCancel.Clicked += ButtonCancel_ClickedAsync;
        }
Exemple #17
0
        private async Task <bool> RemoveParalyzeFromHealer(AppViewModel app)
        {
            if (app.Healer.HasAnyBuff(Buffs.Paralysis))
            {
                if (app.Options.Config.PreferItemOverParalyna &&
                    await app.Actions.UseItem("Remedy"))
                {
                    return(true);
                }

                await PutUpDivineSeal(app);

                if (await app.Actions.CastSpell("Paralyna"))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #18
0
        /// <summary>
        /// Execute closing function and persist session data to be reloaded on next restart
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnClosed(AppViewModel appVM, IViewSize win)
        {
            try
            {
                var settings = GetService <ISettingsManager>();

                settings.SessionData.WindowPosSz.TryGetValue(settings.SessionData.MainWindowName
                                                             , out ViewPosSizeModel viewSz);
                viewSz.GetWindowsState(win);

                _appVM.GetSessionData(settings.SessionData);

                // Save/initialize program options that determine global programm behaviour
                appVM.AppLifeCycle.SaveConfigOnAppClosed(win);
            }
            catch (Exception exp)
            {
                Debug.WriteLine(exp);
            }
        }
Exemple #19
0
 async private void SetPrimaryDomain(Nest.Model.AppDomain priaryDomain)
 {
     /*
      * The default domain is the <apptag>.nestapp.yt
      * this never changes.  The primary domain is the
      * webserver primary domain.  This is needed for
      * SSL certificates.
      *
      */
     try
     {
         priaryDomain.Primary = true;
         AppViewModel.EditApp.PrimaryDomainId = priaryDomain.Id;
         await AppViewModel.UpdateAppAsync(AppViewModel.EditApp);
     }
     catch (Exception ex)
     {
         await ErrorHandler.ExceptionAsync(this, ex);
     }
 }
        public ViewModelLocator()
        {
            myNavigationService = new MyNavigationService();

            appViewModel          = new AppViewModel(myNavigationService);
            logInViewModel        = new LogInViewModel(myNavigationService);
            menyuViewModel        = new MenyuViewModel(myNavigationService);
            tripsViewModel        = new TripsViewModel(myNavigationService);
            registrationViewModel = new RegistrationViewModel(myNavigationService);
            weatherViewModel      = new WeatherViewModel(myNavigationService);
            ticketsPDFViewModel   = new TicketsPDFViewModel(myNavigationService);
            citiesViewModel       = new CitiesViewModel(myNavigationService);
            introViewModel        = new IntroViewModel(myNavigationService);
            mapViewModel          = new MapViewModel(myNavigationService);
            searchInfoViewModel   = new SearchInfoViewModel(myNavigationService);
            ticketsViewModel      = new TicketsViewModel(myNavigationService);

            myNavigationService.Register <LogInViewModel>(logInViewModel);
            myNavigationService.Register <MenyuViewModel>(menyuViewModel);
            myNavigationService.Register <TripsViewModel>(tripsViewModel);
            myNavigationService.Register <RegistrationViewModel>(registrationViewModel);
            myNavigationService.Register <WeatherViewModel>(weatherViewModel);
            myNavigationService.Register <TicketsPDFViewModel>(ticketsPDFViewModel);
            myNavigationService.Register <CitiesViewModel>(citiesViewModel);
            myNavigationService.Register <IntroViewModel>(introViewModel);
            myNavigationService.Register <MapViewModel>(mapViewModel);
            myNavigationService.Register <SearchInfoViewModel>(searchInfoViewModel);
            myNavigationService.Register <TicketsViewModel>(ticketsViewModel);

            //myNavigationService.Register("LogIn", logInViewModel);
            //myNavigationService.Register("Menyu", menyuViewModel);
            //myNavigationService.Register("Trips", tripsViewModel);
            //myNavigationService.Register("Registration", registrationViewModel);

            //myNavigationService.Navigate<LogInViewModel>();
            myNavigationService.Navigate <IntroViewModel>();
            //myNavigationService.Navigate<TicketsPDFViewModel>();
            //myNavigationService.Navigate<TripsViewModel>();

            //myNavigationService.Navigate("LogIn");
        }
        public WelcomePageViewModel(
            IRecentlyUsedItemsService recentlyUsedItemsService,
            ISettingsManager settingsManager,
            IProjectManager projectManager
            )
        {
            _mainViewModel = Locator.Current.GetService <AppViewModel>();

            _projectManager           = projectManager;
            _recentlyUsedItemsService = recentlyUsedItemsService;
            _settingsManager          = settingsManager;

            CloseHomePage = new RelayCommand(ExecuteHome, CanHome);

            SettingsCommand  = new RelayCommand(ExecSC, CanSC);
            TutorialsCommand = new RelayCommand(ExecTC, CanTC);
            WikiCommand      = new RelayCommand(ExecWC, CanWC);

            PinItem        = new DelegateCommand <string>(OnPinItemExecute);
            UnpinItem      = new DelegateCommand <string>(OnUnpinItemExecute);
            OpenInExplorer = new DelegateCommand <string>(OnOpenInExplorerExecute);

            OpenProjectCommand = ReactiveCommand.Create <string>(s =>
            {
                _mainViewModel.OpenProjectCommand.Execute(s).Subscribe();
            });
            DeleteProjectCommand = ReactiveCommand.Create <string>(s =>
            {
                _mainViewModel.DeleteProjectCommand.Execute(s).Subscribe();
            });
            NewProjectCommand = ReactiveCommand.Create(() =>
            {
                _mainViewModel.NewProjectCommand.Execute().Subscribe();
            });

            recentlyUsedItemsService.Items
            .Connect()
            .ObserveOn(RxApp.MainThreadScheduler)
            .Bind(out _recentlyUsedItems)
            .Subscribe(OnRecentlyUsedItemsChanged);
        }
Exemple #22
0
        public static void LoadTab(AppViewModel vm, string[] paths)
        {
            if (paths?.Length == 0 || string.IsNullOrEmpty(paths?[0]))
            {
                return;
            }

            if (paths.Length == 1 && File.Exists(paths[0]))
            {
                IScreen[] viewModels = GetViewModelsByPath(paths[0], true, true);
                if (viewModels?.Length > 0)
                {
                    foreach (IScreen viewModel in viewModels)
                    {
                        vm.Items.Add(viewModel);
                        vm.ActiveItem = viewModel;
                    }
                }
            }
            else
            {
                List <IScreen> viewModels = new List <IScreen>();
                foreach (string path in paths.Where(p => File.Exists(p)))
                {
                    IScreen viewModel = GetViewModelsByPath(path, false, false)?[0];
                    if (viewModel != null)
                    {
                        viewModels.Add(viewModel);
                    }
                }

                if (viewModels.Count > 0)
                {
                    DocumentContainerViewModel documentContainerViewModel = new DocumentContainerViewModel(paths, viewModels.ToArray());
                    if (documentContainerViewModel != null)
                    {
                        vm.ActiveItem = documentContainerViewModel;
                    }
                }
            }
        }
        public AppBackupView(AppViewModel appViewModel)
        {
            InitializeComponent();

            AppViewModel = appViewModel;

            SetActivityMonotoring(ServiceActive,
                                  new List <Xamarin.Forms.View> {
                ButtonCancel,
                ButtonRestore,
                ButtonBackup,
                ButtonRefresh
            });

            _activityIndicator = ServiceActive;

            ButtonCancel.Clicked  += ButtonCancel_ClickedAsync;
            ButtonRestore.Clicked += ButtonRestore_ClickedAsync;
            ButtonBackup.Clicked  += ButtonBackup_ClickedAsync;
            ButtonRefresh.Clicked += ButtonRefresh_ClickedAsync;
        }
        public async Task <IActionResult> Create()
        {
            var actualUser = await _userHelper.GetUserByEmailAsync(User.Identity.Name);

            var customer = _context.Customers.Where(c => c.User.Id == actualUser.Id);

            if (customer == null)
            {
                return(NotFound());
            }

            var model = new AppViewModel
            {
                Doctors      = _combosHelper.GetComboDoctors(),
                Customers    = _combosHelper.GetComboCustomers(),
                Pets         = _combosHelper.GetComboPets(0),
                ServiceTypes = _combosHelper.GetComboServiceTypes()
            };

            return(View(model));
        }
        public async Task <bool> ExecuteAsync(AppViewModel app)
        {
            if (app.Options.Config.AcceptRaise == true &&
                (app.Healer.GetEntityStatus() == EntityStatus.Dead ||
                 app.Healer.GetEntityStatus() == EntityStatus.DeadEngaged))
            {
                if (app.Healer.Menu.IsMenuOpen &&
                    app.Healer.Menu.HelpName == "Revival" &&
                    app.Healer.Menu.MenuIndex == 1)
                {
                    await Task.Delay(3000);

                    app.Healer.ThirdParty.KeyPress(EliteMMO.API.Keys.NUMPADENTER);
                    await Task.Delay(500);

                    return(true);
                }
            }

            return(false);
        }
Exemple #26
0
        public AppViewModel GetById(Guid id)
        {
            var lessonPresentation = _lessonPresentationRepository.GetById(id);
            var lessonResults      = _lessonResultRepository.Find(l => l.LessonPresentationId == id);
            var rest      = lessonResults.Where(x => x.LessonPresentationId == id);
            var minTime   = rest.Any() ? rest.Min(x => x.Time) : null;
            var minErrors = rest.Any() ? rest.Min(x => x.Errors) : null;

            var preview = new AppViewModel
            {
                Id        = id,
                Name      = lessonPresentation.Name,
                Category  = lessonPresentation.Category,
                Started   = rest.Any(),
                Text      = lessonPresentation.Text,
                MinTime   = minTime,
                MinErrors = minErrors
            };

            return(preview);
        }
        private async Task <bool> CastSpikesSpell(AppViewModel app)
        {
            var spellName = app.Options.Config.SelfSpikesSpellName;

            if (string.IsNullOrWhiteSpace(spellName))
            {
                return(false);
            }

            short buff = spellName switch
            {
                "Ice Spikes" => Buffs.IceSpikes,
                "Shock Spikes" => Buffs.ShockSpikes,
                "Blaze Spikes" => Buffs.BlazeSpikes,
                _ => - 1
            };

            return
                (!app.Buffs.HasAny(app.Healer.Player.Name, buff) &&
                 await app.Actions.CastSpell(spellName));
        }
        public AppAuditView(AppViewModel appViewModel)
        {
            InitializeComponent();

            AppViewModel = appViewModel;

            SetActivityMonotoring(ServiceActive,
                                  new List <Xamarin.Forms.View> {
                ButtonCancel,
                ButtonQuery
            });

            _activityIndicator = ServiceActive;

            ButtonQuery.Clicked  += ButtonQuery_Clicked;
            ButtonCancel.Clicked += ButtonCancel_ClickedAsync;

            ResetTimeFilter();

            QueryAsync();
        }
Exemple #29
0
        /// <summary>
        /// Save session data on closing
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnClosing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            try
            {
                AppViewModel wsVM = base.MainWindow.DataContext as AppViewModel;

                if (wsVM != null)
                {
                    var MainWindowCanClose = MainWindow as IMetroWindow;

                    if (MainWindowCanClose != null)
                    {
                        if (MainWindowCanClose.IsContentDialogVisible == true)
                        {
                            e.Cancel = true;                                 // Lets not close with open dialog
                            return;
                        }
                    }

                    // Close all open files and check whether application is ready to close
                    if (wsVM.AppLifeCycle.Exit_CheckConditions(wsVM) == true)
                    {
                        // (other than exception and error handling)
                        wsVM.AppLifeCycle.OnRequestClose(true);

                        _mainWindow.OnSaveLayout();
                        e.Cancel = false;
                    }
                    else
                    {
                        wsVM.AppLifeCycle.CancelShutDown();
                        e.Cancel = true;
                    }
                }
            }
            catch (Exception exp)
            {
                Debug.WriteLine(exp);
            }
        }
Exemple #30
0
        async Task UpdateServicesAsync()
        {
            if (_selectedAppRow == null)
            {
                return;
            }

            if (_isUpgrading)
            {
                AppViewModel.ServicesViewModel.UpgradeAppServiceTier(_selectedAppRow.Tier);
                await MainView.StackViewSkipBackAsync(new AppSummaryView(AppViewModel));
            }
            else
            {
                if (AppViewModel.EditApp.Status != "assigned")
                {
                    await AppViewModel.CreateAppAsync(_selectedAppRow.Tier);

                    await AppViewModel.InitAsync();

                    BaseViewModels.AppCollectionViewModel.AddModel(AppViewModel);
                }

                if (_selectedAppRow != null && (
                        AppViewModel.ServicesViewModel.SelectedAppServiceTableItem == null ||
                        AppViewModel.ServicesViewModel.SelectedAppServiceTableItem.Tier.Id != _selectedAppRow.Tier.Id))
                {
                    await AppViewModel.ServicesViewModel.SwitchAppServiceTierAsync(_selectedAppRow.Tier);
                }

                if (AppViewModel.ServicesViewModel.SelectedStorageServiceTableItem == null && MariaDBEnabled.IsToggled)
                {
                    await AppViewModel.ServicesViewModel.CreateDefaultStorageServiceAsync();
                }
                else if (AppViewModel.ServicesViewModel.SelectedStorageServiceTableItem != null && !MariaDBEnabled.IsToggled)
                {
                    await AppViewModel.ServicesViewModel.RemoveDefaultStorageServiceAsync();
                }
            }
        }
        private async void ButtonRestore_ClickedAsync(object sender, EventArgs e)
        {
            IsServiceActive = true;

            try
            {
                if (AppBackups.SelectedItem != null)
                {
                    bool proceed = await DisplayAlert("Nester",
                                                      "This will restore from a backup and replace the current App. Proceed?", "Yes", "No");

                    if (!proceed)
                    {
                        IsServiceActive = false;
                        return;
                    }

                    await AppViewModel.DeploymentViewModel.RestoreAppAsync(
                        AppBackups.SelectedItem as Nest.Model.AppBackup);

                    // Reload everything
                    await AppViewModel.InitAsync();

                    AppView appView = await MainView.GetAppViewAsync(AppViewModel);

                    if (appView != null)
                    {
                        appView.UpdateStatus();
                    }
                }

                await MainView.UnstackViewAsync();
            }
            catch (Exception ex)
            {
                await ErrorHandler.ExceptionAsync(this, ex);
            }

            IsServiceActive = false;
        }
Exemple #32
0
        private async Task <bool> RemoveSleepgaFromPlayers(AppViewModel app)
        {
            var party = new List <PlayerViewModel>();
            var other = new List <PlayerViewModel>();

            foreach (var player in app.ActivePlayers.SortByJob())
            {
                if (app.Buffs.HasAny(player.Name, Buffs.Sleep, Buffs.Sleep2))
                {
                    if (player.IsInHealerParty)
                    {
                        party.Add(player);
                    }
                    else
                    {
                        other.Add(player);
                    }
                }
            }

            if (party.Any())
            {
                var target = party.First();
                if (await app.Actions.CastSpell("Curaga", target.Name))
                {
                    return(true);
                }
            }

            if (other.Any())
            {
                var target = other.First();
                if (await app.Actions.CastSpell("Cure", target.Name))
                {
                    return(true);
                }
            }

            return(false);
        }
        private async Task <bool> CastEntrustIndiSpell(AppViewModel app)
        {
            if (!app.Options.Config.EnableIndiSpells)
            {
                return(false);
            }
            if (!app.Options.Config.EnableEntrust)
            {
                return(false);
            }

            var target = GetGeoSpellTarget(app);

            if (target == null)
            {
                return(false);
            }

            foreach (var player in app.ActivePlayers)
            {
                if (player.IsInHealerParty && player.IsEntrustTarget)
                {
                    if (!player.HasAnyBuff(Buffs.ColureActive))
                    {
                        if (await app.Actions.UseAbility("Entrust"))
                        {
                            var spellName = app.Options.Config.EntrustIndiSpellName;
                            if (await app.Actions.CastSpell($"Indi-{spellName}", player.Name))
                            {
                                return(true);
                            }
                        }
                    }

                    break;
                }
            }

            return(false);
        }
Exemple #34
0
        public AppViewModel GetAppByAppID(string AppID)
        {
            AppViewModel AppDetils = new AppViewModel();

            try
            {
                var    request  = new RestRequest(Method.GET);
                string Url      = WebConfigurationManager.AppSettings["WebUrl"];
                string AuthCode = WebConfigurationManager.AppSettings["AuthCode"];
                var    client   = new RestClient(Url + "/" + AppID);
                client.Timeout = 1000;
                request.AddHeader("Content-Type", "application/json");
                request.AddHeader("Authorization", "Basic " + AuthCode);
                IRestResponse response = client.Execute(request);
                var           result   = response.Content.ToString();
                AppDetils = JsonConvert.DeserializeObject <AppViewModel>(result);
            }
            catch (Exception e)
            {
            }
            return(AppDetils);
        }
 public NewReservation(AppViewModel app, Car chooseCar = null, Client chooseClient = null)
 {
     InitializeComponent();
     DataContext                 = app;
     appviemodel                 = app;
     cbPickupLoc.ItemsSource     = Enum.GetValues(typeof(Location)).Cast <Location>();
     cbReturnLoc.ItemsSource     = Enum.GetValues(typeof(Location)).Cast <Location>();
     appviemodel.BillAct.NewBill = null;
     appviemodel.BillAct.NewBill = new Bill();
     if (!appviemodel.IsAdmin)
     {
         gdClient.Visibility = Visibility.Collapsed;
     }
     if (chooseCar != null)
     {
         appviemodel.BillAct.NewBill.Rent.Car = chooseCar;
     }
     if (chooseClient != null && !appviemodel.IsAdmin)
     {
         appviemodel.BillAct.NewBill.Rent.Client = chooseClient;
     }
 }
        public IActionResult Share(int id)
        {
            User   userOwner = Functions.getUser(_cache);
            Passwd passwd    = _db.Passwds.Where(a => a.Id == id).FirstOrDefault();

            if (userOwner.Id != passwd.UserId)
            {
                _cache.Set(CacheNames.error4, "You are not the owner");
                return(RedirectToAction("Index"));
            }

            AppViewModel appViewModel = new AppViewModel
            {
                User   = Functions.getUser(_cache),
                Logged = Functions.getLogged(_cache),
                Passwd = _db.Passwds.Where(a => a.Id == id).FirstOrDefault(),
                Error  = Functions.getError(_cache, CacheNames.error3)
            };

            _cache.Remove(CacheNames.error3);
            return(View(appViewModel));
        }
Exemple #37
0
        private async Task InitializeAsync()
        {
            // Test if download path has been specified by user, if not, prompt
            // If download path exists, check if valid
            if (string.IsNullOrEmpty(Settings.Default.DownloadPath) || !Directory.Exists(Settings.Default.DownloadPath))
            {
                this.PromptUserForDownloadDirectory();
            }

            // Test if AppViewModel singleton instance exists
            if (AppViewModel.Instance == null)
            {
                // Set data context for the main screen and load main screen
                AppViewModel.Instance = AppViewModel.Create();
                this.DataContext      = AppViewModel.Instance;
            }

            // Make instance of the DownloadViewModel and set it as datacontext.
            // This will set the active view as the DownloadView
            try
            {
                var downloadViewModel = new DownloadViewModel();
                AppViewModel.Instance.DisplayViewModel = downloadViewModel;
                await downloadViewModel.ConnectToPortalAsync();
            }
            catch (Exception ex)
            {
                // If unexpected exception happens during download, ignore it and load existing map
                System.Windows.MessageBox.Show(
                    "An error has occured during the map download: " + ex.Message + " The previously downloaded map will now be loaded.",
                    "Unhandled Exception",
                    MessageBoxButton.OK,
                    MessageBoxImage.Error);
            }
            finally
            {
                await this.LoadMmpkAsync();
            }
        }
Exemple #38
0
        public WebView(Pages page, AppViewModel appViewModel)
        {
            InitializeComponent();

            AppViewModel = appViewModel;

            _activityIndicator = ServiceActive;

            switch (page)
            {
            case Pages.AppPage:
                // TODO : prevent the page from being cached
                // the 'under-construction' page is cached
                // even when the site is up
                Browser.Source = "https://" + AppViewModel.DomainViewModel.DefaultDomain.Name + "/?cache=no";
                break;

            case Pages.AppSlackConnect:
                LoadSlackPageAsync();
                break;
            }
        }
Exemple #39
0
        private async Task <bool> RemoveDoomFromPlayers(AppViewModel app, bool curseToo = false)
        {
            var buffsToCheck = curseToo
                                ? new[] { Buffs.Doom, Buffs.Curse }
                                : new[] { Buffs.Doom };

            if (app.Healer.HasAnyBuff(buffsToCheck))
            {
                if (app.Options.Config.PreferItemOverCursna)
                {
                    if (await app.Actions.UseItem("Hallowed Water") ||
                        await app.Actions.UseItem("Holy Water"))
                    {
                        return(true);
                    }
                }

                if (await app.Actions.CastSpell("Cursna"))
                {
                    return(true);
                }
            }

            foreach (var player in app.ActivePlayers.SortByJob())
            {
                if (player.HasAnyBuff(buffsToCheck))
                {
                    await PutUpDivineSeal(app);

                    if (await app.Actions.CastSpell("Cursna", player.Name))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
 public ScrollingModulesConfigurationViewModel( string displayName, AppViewModel app )
     : base("{84DF23DC-C95A-40ED-9F60-F39CD350E79A}", "Scrolling", app)
 {
     DisplayName = displayName;
 }
 public MouseRadarViewModel( AppViewModel app )
     : base("{390AFE83-C5A2-4733-B5BC-5F680ABD0111}", "Configuraton du Radar", app)
 {
 }
Exemple #42
0
 public SkinViewModel( AppViewModel app )
     : base("{36C4764A-111C-45e4-83D6-E38FC1DF5979}", R.SkinConfig, app)
 {
     _app = app;
 }
 public AppAdvancedConfigViewModel( AppViewModel app )
     : base(app.ConfigManager)
 {
     DisplayName = R.AdvancedAppConfig;
     _app = app;
 }
Exemple #44
0
 public void Teardown()
 {
     _stopping = false;
     _appViewModel = null;
     _windowManager = null;
 }
        public void Start()
        {
            _windowManager = new CustomWindowManager();
            _appViewModel = new AppViewModel( this );
            _windowManager.ShowWindow( _appViewModel, null, null );

            _mainWindow = _appViewModel.GetView( null ) as Window;
            //_interopHelper = new WindowInteropHelper( _mainWindow );
            //RegisterHotKeys();

            _contextSaver = Context.ServiceContainer.GetService<IContextSaver>();

            _sharedDictionary = Context.ServiceContainer.GetService<ISharedDictionary>();

            _mainWindow.Closing += OnWindowClosing;
        }
 public CreditViewModel( AppViewModel app )
     : base(app.ConfigManager)
 {
     DisplayName = R.Credits;
     _app = app;
 }
 public ScrollingViewModel( string displayName, AppViewModel app )
     : base(app.ConfigManager)
 {
     _app = app;
     DisplayName = displayName;
 }
 public ScreenScrollerViewModel( AppViewModel app )
     : base("{AE25D80B-B927-487E-9274-48362AF95FC0}", "Configuraton du défilement d'écran", app)
 {
 }
Exemple #49
0
        public void Start()
        {
            _windowManager = new CustomWindowManager();
            _appViewModel = new AppViewModel( this );
            _windowManager.ShowWindow( _appViewModel, null, null );

            _mainWindow = _appViewModel.GetView( null ) as Window;
            //_interopHelper = new WindowInteropHelper( _mainWindow );
            //RegisterHotKeys();

            _mainWindow.Closing += OnWindowClosing;

            if( HelpService.Status == InternalRunningStatus.Started )
            {
                HelpService.Service.RegisterHelpContent( PluginId, typeof( KeyboardEditor ).Assembly.GetManifestResourceStream( "KeyboardEditor.Resources.helpcontent.zip" ) );
            }
            else if( HelpService.Status.IsStoppedOrDisabled ) HelpService.ServiceStatusChanged += HelpService_ServiceStatusChanged;
        }
 public AutoClickViewModel( AppViewModel app )
     : base("{989BE0E6-D710-489e-918F-FBB8700E2BB2}", R.AutoClickConfig, app)
 {
 }
 public ShareKeyboardViewModel( AppViewModel app )
     : base(app.ConfigManager)
 {
     DisplayName = R.ShareKeyboard;
     _app = app;
 }