예제 #1
0
 public StartupViewController()
 {
     ViewModel = new StartupViewModel(
         Mvx.Resolve <ILoginFactory>(),
         Mvx.Resolve <IApplicationService>(),
         Mvx.Resolve <IDefaultValueService>());
 }
예제 #2
0
        public ActionResult Startup(StartupViewModel vmodel)
        {
            var setupConfig = SetupHelper.LoadSetup();

            setupConfig.StartupType = vmodel.StartupType;

            if (vmodel.StartupType == StartupTypes.Page)
            {
                setupConfig.StartupUrl = "/" + vmodel.PageSlug;
            }

            if (vmodel.StartupType == StartupTypes.Post)
            {
                setupConfig.StartupUrl = "/Post/" + vmodel.PostSlug;
            }

            if (vmodel.StartupType == StartupTypes.Category)
            {
                setupConfig.StartupUrl = "/Category/" + vmodel.PageSlug;
            }

            if (vmodel.StartupType == StartupTypes.Module)
            {
                setupConfig.StartupUrl = vmodel.ModuleSiteMenuUrl;
            }

            SetupHelper.UpdateSetup(setupConfig);
            var model = PrepareStartupViewData();

            return(View(model));
        }
예제 #3
0
        public StartupView()
        {
            InitializeComponent();

            vm = DataContext as StartupViewModel;
            vm.PropertyChanged += viewModel_PropertyChanged;
        }
예제 #4
0
        public ActionResult RoleStartup(StartupViewModel vmodel, long[] Roles)
        {
            var finalUrl = GetFinalStartupUrl(vmodel);

            _startupService.SaveOrUpdate(finalUrl, vmodel.RoleStartupType, Roles);
            TempData["SuccessMessage"] = "Update Successful";
            return(RedirectToAction("Startup"));
        }
예제 #5
0
        public StartupViewModelTests()
        {
            _screen = new Screen();
            _navigation = new Mock<INavigationService>();

            _viewModel = new StartupViewModel(
                new[] {_screen}, _navigation.Object);
        }
예제 #6
0
        public MainViewModel(
            ScripturesViewModel scripturesViewModel,
            PreviewViewModel previewViewModel,
            SettingsViewModel settingsViewModel,
            EditTextViewModel editVerseTextViewModel,
            StartupViewModel startupViewModel,
            IImagesService imagesService,
            IOptionsService optionsService,
            ISnackbarService snackbarService,
            IUserInterfaceService userInterfaceService,
            ICommandLineService commandLineService,
            IVerseEditorService verseEditorService)
        {
            _scripturesViewModel    = scripturesViewModel;
            _previewViewModel       = previewViewModel;
            _settingsViewModel      = settingsViewModel;
            _editVerseTextViewModel = editVerseTextViewModel;
            _startupViewModel       = startupViewModel;
            _commandLineService     = commandLineService;
            _verseEditorService     = verseEditorService;

            if (commandLineService.NoGpu || ForceSoftwareRendering())
            {
                // disable hardware (GPU) rendering so that it's all done by the CPU...
                RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
            }

            _settingsViewModel.EpubChangedEvent += HandleEpubChangedEvent;

            _previewViewModel.EditTextCommandEvent += HandleEditTextCommandEvent;

            _imagesService        = imagesService;
            _optionsService       = optionsService;
            _snackbarService      = snackbarService;
            _userInterfaceService = userInterfaceService;

            _optionsService.AlwaysOnTopChangedEvent += HandleAlwaysOnTopChangedEvent;
            _optionsService.EpubPathChangedEvent    += HandleEpubPathChangedEvent;

            InitCommands();

            _currentPage     = scripturesViewModel;
            _preSettingsPage = scripturesViewModel;

            if (IsNewInstallation())
            {
                _currentPage = startupViewModel;
            }
            else if (IsBadEpubPath())
            {
                _currentPage = settingsViewModel;
            }

            _nextPageTooltip = Properties.Resources.NEXT_PAGE_PREVIEW;

            GetVersionData();
        }
예제 #7
0
        public IActionResult Index()
        {
            if (_startup.IsInitialized())
            {
                return(NotFound());
            }
            var model = new StartupViewModel();

            return(View(model));
        }
예제 #8
0
        private void Initialize()
        {
            viewModel = base.DataContext as StartupViewModel;
            viewModel.CheckNull();

            this.Loaded += (object sender, RoutedEventArgs e) =>
            {
                new Thread(() => StartTask()).Start();
            };
        }
예제 #9
0
        public ActionResult Index()
        {
            var viewModel = new StartupViewModel
            {
                DisplayName = User.Identity.Name,
                UserName    = User.Identity.Name,
                UserId      = User.Identity.Name
            };

            return(View(viewModel));
        }
예제 #10
0
        public async Task <(bool result, List <DomainError> errors)> Initialize(StartupViewModel model)
        {
            var userResult = await InitializeAdminUser(model.DefaultUser);

            var result = userResult;

            _initialized = result.result;
            if (_initialized)
            {
                _startupRepository.SetInitialized();
            }

            return(result);
        }
예제 #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HomeViewModel"/> class.
        /// </summary>
        public HomeViewModel()
        {
            ManageSchedulers.SetLogFileName(0);
            MenuClickCommand                 = new BaseCommand(MenuClick);
            InputCommand                     = new BaseCommand(UserInput);
            StatusUpdate.StatusChanged      += StatusUpdate_StatusChanged;
            StatusUpdate.PopUpStatusChanged += (isPopUpOpen) => { IsPopupOpen = isPopUpOpen; };

            StatusUpdate.StatusMessage = Utilities.GetResourceValue("Loading");
            ThreadHelper.RunBackGround(delegate
            {
                Element = new StartupViewModel(this);
            });
        }
예제 #12
0
        public StartupViewModel PrepareStartupViewData()
        {
            var setupConfig        = SetupHelper.LoadSetup();
            var model              = new StartupViewModel();
            var moduleSiteMenuList = new List <SiteMenuItem>();
            var roleList           = _nccPermissionService.LoadAll().Select(x => new { Name = x.Name, Value = x.Id }).ToList();

            model.Url         = setupConfig.StartupUrl;
            model.StartupType = setupConfig.StartupType;

            //original was Slug , Title
            model.Pages      = new SelectList(_pageService.LoadAll(true), "Id", "Name", setupConfig.StartupData);
            model.Posts      = new SelectList(_postService.Load(0, 100, true, true), "Id", "Name", setupConfig.StartupData);
            model.Categories = new SelectList(_categoryService.LoadAll(true), "Id", "Name", setupConfig.StartupData);
            NccMenuHelper.GetModulesSiteMenus().Select(x => x.Value).ToList().ForEach(x => moduleSiteMenuList.AddRange(x));
            model.ModuleSiteMenus = new SelectList(moduleSiteMenuList, "Url", "Url", setupConfig.StartupData);
            model.Roles           = new SelectList(roleList, "Value", "Name");

            ViewBag.RoleStartups = _startupService.LoadAll(true, 0, "", false);

            ViewBag.DefaultChecked  = "";
            ViewBag.PageChecked     = "";
            ViewBag.CategoryChecked = "";
            ViewBag.PostChecked     = "";
            ViewBag.ModuleChecked   = "";

            if (setupConfig.StartupType == StartupTypeText.Page)
            {
                ViewBag.PageChecked = "checked";
            }
            else if (setupConfig.StartupType == StartupTypeText.Post)
            {
                ViewBag.PostChecked = "checked";
            }
            else if (setupConfig.StartupType == StartupTypeText.Category)
            {
                ViewBag.CategoryChecked = "checked";
            }
            else if (setupConfig.StartupType == StartupTypeText.Module)
            {
                ViewBag.ModuleChecked = "checked";
            }
            else
            {
                ViewBag.DefaultChecked = "checked";
            }

            return(model);
        }
예제 #13
0
        private void App_OnStartup(object sender, StartupEventArgs e)
        {
            var viewModel = new StartupViewModel();
            var view      = new Startup();

            viewModel.OkCommand = new RelayCommand(() =>
            {
                int clientId;
                if (!int.TryParse(viewModel.ClientId, out clientId))
                {
                    MessageBox.Show("Client id must be a number");
                    return;
                }

                int serverCommandPort;
                if (!int.TryParse(viewModel.CommandPort, out serverCommandPort))
                {
                    MessageBox.Show("Command port must be a number");
                    return;
                }

                int serverPublishPort;
                if (!int.TryParse(viewModel.PublishPort, out serverPublishPort))
                {
                    MessageBox.Show("Publish port must be a number");
                    return;
                }

                var config = new Configuration
                {
                    ClientId          = clientId,
                    ServerAddress     = viewModel.ServerAddress,
                    ServerCommandPort = serverCommandPort,
                    ServerPublishPort = serverPublishPort
                };
                StartApplication(config);
                view.Close();
            });

            viewModel.CancelCommand = new RelayCommand(() =>
            {
                view.Close();
                App_OnExit(this, null);
            });

            view.DataContext = viewModel;
            view.ShowDialog();
        }
예제 #14
0
        public StartupViewModel PrepareStartupViewData()
        {
            var setupConfig        = SetupHelper.LoadSetup();
            var model              = new StartupViewModel();
            var moduleSiteMenuList = new List <SiteMenuItem>();

            model.Default     = setupConfig.StartupUrl;
            model.StartupType = setupConfig.StartupType;

            model.Pages      = new SelectList(_pageService.LoadAllActive(), "Slug", "Title", GetSlug(setupConfig.StartupUrl));
            model.Posts      = new SelectList(_postService.LoadAllByPostStatusAndDate(NccPost.NccPostStatus.Published, DateTime.Now), "Slug", "Title", GetSlug(setupConfig.StartupUrl));
            model.Categories = new SelectList(_categoryService.LoadAllActive(), "Slug", "Title", GetSlug(setupConfig.StartupUrl));
            AdminMenuHelper.ModulesSiteMenus().Select(x => x.Value).ToList().ForEach(x => moduleSiteMenuList.AddRange(x));
            model.ModuleSiteMenus = new SelectList(moduleSiteMenuList, "Url", "Url", setupConfig.StartupUrl);

            ViewBag.DefaultChecked  = "";
            ViewBag.PageChecked     = "";
            ViewBag.CategoryChecked = "";
            ViewBag.PostChecked     = "";
            ViewBag.ModuleChecked   = "";

            if (setupConfig.StartupType == StartupTypes.Page)
            {
                ViewBag.PageChecked = "checked";
            }
            else if (setupConfig.StartupType == StartupTypes.Post)
            {
                ViewBag.PostChecked = "checked";
            }
            else if (setupConfig.StartupType == StartupTypes.Category)
            {
                ViewBag.CategoryChecked = "checked";
            }
            else if (setupConfig.StartupType == StartupTypes.Module)
            {
                ViewBag.ModuleChecked = "checked";
            }
            else
            {
                ViewBag.DefaultChecked = "checked";
            }

            return(model);
        }
예제 #15
0
    protected override void OnCreate(IBundle bundle)
    {
        this.viewModel = new StartupViewModel();

        /* databinding, Bound to the ViewModel. */
        BindingSet <StartupWindow, StartupViewModel> bindingSet = this.CreateBindingSet(viewModel);

        bindingSet.Bind().For(v => v.OnOpenIdleWindow).To(vm => vm.IdleRequest);
        bindingSet.Bind().For(v => v.OnDismissRequest).To(vm => vm.DismissRequest);


        bindingSet.Bind(this.progressBarSlider).For("value", "onValueChanged").To("ProgressBar.Progress").TwoWay();
        bindingSet.Bind(this.progressBarSlider.gameObject).For(v => v.activeSelf).To(vm => vm.ProgressBar.Enable).OneWay();
        /* expression binding,support only OneWay mode. */
        //bindingSet.Bind(this.progressBarText).For(v => v.text).ToExpression(vm=>string.Format("{0}%", Mathf.FloorToInt(vm.ProgressBar.Progress * 100f))).OneWay();
        //bindingSet.Bind(this.tipText).For(v => v.text).To(vm => vm.ProgressBar.Tip).OneWay();
        bindingSet.Build();

        this.viewModel.Download();
    }
예제 #16
0
        public async Task <IActionResult> Index(StartupViewModel model)
        {
            if (_startup.IsInitialized())
            {
                return(NotFound());
            }
            var result = await _startup.Initialize(model);

            if (result.result)
            {
                return(Redirect("/"));
            }

            result.errors?.ForEach(error =>
            {
                ModelState.AddModelError(error.Code, error.Description);
            });

            return(View(model));
        }
예제 #17
0
        protected override void OnCreate(Bundle bundle)
        {
            ViewModel = new StartupViewModel();
            base.OnCreate(bundle);
            RequestWindowFeature(WindowFeatures.NoTitle);

            SetContentView(Resource.Layout.StartupView);

            var button = FindViewById <Button>(Resource.Id.Startup_SignInButton);

            button.Click += Button_Click;

            var viewPager = FindViewById <ViewPager>(Resource.Id.Startup_ViewPager);

            viewPager.Adapter            = new StartupPageAdapter(SupportFragmentManager);
            viewPager.OffscreenPageLimit = 5;
            viewPager.PageSelected      += ViewPager_PageSelected;

            _startup_CircleIndicatorParent = FindViewById <LinearLayout>(Resource.Id.Startup_CircleIndicatorParent);
            SetCircleIndicatorsOpacity(new ViewPager.PageSelectedEventArgs(0));
        }
예제 #18
0
        public StartupPage(StartupViewModel viewModel)
        {
            viewModel.Navigation = Navigation;
            BindingContext       = viewModel;

            BackgroundColor = Helpers.Color.Blue.ToFormsColor();

            var layout = new StackLayout {
                Padding         = 10,
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            var label = new Label
            {
                Text      = "Initializing Session",
                FontSize  = 20,
                TextColor = Color.White,
                XAlign    = TextAlignment.Center,              // Center the text in the blue box.
            };

            layout.Children.Add(label);

            var progress = new ActivityIndicator()
            {
                Color = Color.White
            };

            progress.IsRunning = true;

            layout.Children.Add(progress);

            Content = new ScrollView {
                Content = layout
            };

            Task.Run(async() => {
                await viewModel.Start();
            });
        }
예제 #19
0
        public ShellViewModel(Settings settings)
        {
            this.Settings = settings;

            this.IrcMainViewModel        = new IrcMainViewModel();
            this.IrcMainViewModel.Parent = this;

            var svm = new StartupViewModel();

            svm.Parent = this;

            if (this.Settings.CanLog)
            {
                DirectoryInfo di = new DirectoryInfo(Settings.PATH + @"logs\");
                if (!di.Exists)
                {
                    di.Create();
                }
            }

            this.DisplayName = "Handle";
            ActivateItem(svm);
        }
예제 #20
0
        protected override void OnInitialActivate()
        {
            var appStartup = new StartupViewModel(windowManager);

            windowManager.ShowDialog(appStartup);

            #region LOGIN

            var login = new LoginViewModel();
            var res   = windowManager.ShowDialog(login);

            if (!res.HasValue || !res.Value)
            {
                try { showClose(); } catch { }
            }
            NotifyOfPropertyChange("ConnectedUser");

            #endregion LOGIN



            var setupside = SetupSideMenu();
            setupside.Wait();
            SetupTopBar();
            NotifyOfPropertyChange("MainMenuCategories");

            NotifyAppLogo();


            // If First launch start app assistant
            if (DataHelpers.Settings?.AppInitialized == false)
            {
                StartAppAssistant();
            }

            UpdateNotificationsTitle();
        }
예제 #21
0
 public StartupView(MainWindow mainWindow)
 {
     InitializeComponent();
     DataContext = new StartupViewModel();
     Main        = mainWindow;
 }
예제 #22
0
 public void Init()
 {
     _startViewModel = new StartupViewModel(
         new UnityContainer(),
         new UserService(new InMemoryRepository <User>()));
 }
예제 #23
0
        public string GetFinalStartupUrl(StartupViewModel vmodel)
        {
            var finalUrl = "";

            if (vmodel.RoleStartupType == StartupTypeText.Url)
            {
                finalUrl = vmodel.Url;
            }
            else if (vmodel.RoleStartupType == StartupTypeText.Page)
            {
                var page = _pageService.Get(long.Parse(vmodel.PageId));
                if (page == null)
                {
                    TempData["ErrorMessage"] = "Page not found.";
                }
                var pageDetails = page.PageDetails.Where(x => x.Language == GlobalContext.WebSite.Language).FirstOrDefault();
                if (pageDetails == null)
                {
                    TempData["ErrorMessage"] = "Page for default language not found.";
                }
                else
                {
                    finalUrl = "/" + pageDetails.Slug;
                }
            }
            else if (vmodel.RoleStartupType == StartupTypeText.Post)
            {
                var post = _postService.Get(long.Parse(vmodel.PostId));
                if (post == null)
                {
                    TempData["ErrorMessage"] = "Post not found.";
                }
                var postDetails = post.PostDetails.Where(x => x.Language == GlobalContext.WebSite.Language).FirstOrDefault();
                if (postDetails == null)
                {
                    TempData["ErrorMessage"] = "Post for default language not found.";
                }
                else
                {
                    finalUrl = "/Post/" + postDetails.Slug;
                }
            }
            else if (vmodel.RoleStartupType == StartupTypeText.Category)
            {
                var category = _categoryService.Get(long.Parse(vmodel.CategoryId));
                if (category == null)
                {
                    TempData["ErrorMessage"] = "Category not found.";
                }
                var categoryDetails = category.CategoryDetails.Where(x => x.Language == GlobalContext.WebSite.Language).FirstOrDefault();
                if (categoryDetails == null)
                {
                    TempData["ErrorMessage"] = "Category for default language not found.";
                }
                else
                {
                    finalUrl = "/Category/" + categoryDetails.Slug;
                }
            }
            else if (vmodel.RoleStartupType == StartupTypeText.Module)
            {
                finalUrl = vmodel.ModuleSiteMenuUrl;
            }
            else
            {
                finalUrl = "";
            }
            return(finalUrl);
        }
예제 #24
0
 public StartupView(StartupViewModel viewModel)
 {
     InitializeComponent();
     ViewModel   = viewModel;
     DataContext = ViewModel;
 }
예제 #25
0
        /// <summary>
        /// Menus the click.
        /// </summary>
        /// <param name="arg">The argument.</param>
        private void MenuClick(object arg)
        {
            StatusMessage = Utilities.GetResourceValue("Loading");
            switch ((string)arg)
            {
            case "Dashboard":
                Element = new StartupViewModel(this);
                break;

            case "EcommerceDashboard":
                Element = new Dashboard.Ecommerce.EcommerceViewModel();
                break;

            case "EcommerceDashboard1":
                Element = new Dashboard.Ecommerce.EcommerceViewModel(1);
                break;

            case "ErpDashBoard":
                Element = new Dashboard.Erp.ErpViewModel();
                break;

            case "ErpDashBoard1":
                Element = new Dashboard.Erp.ErpViewModel(1);
                break;

            case "SchedulerControl":
                Element = new Schedulers.SchedulersViewModel();
                break;

            case "Logfiles":
                Element = new LogFileViewModel();
                break;

            case "ConfigurationSettings":
                Element = new Configuration.ConfigurationSettingsViewModel(this);
                break;

            case "NotificationSettings":
                Element = new Configuration.NotificationViewModel();
                break;

            case "ShipmentSettings":
                Element = new Configuration.ShipmentSettingsViewModel();
                break;

            case "CarrierSettings":
                Element = new Configuration.ShippingCarrierViewModel();
                break;

            case "PaymentSettings":
                Element = new Configuration.PaymentSettingsViewModel();
                break;

            case "DocumentTypes":
                Element = new Configuration.DocumentTypesViewModel();
                break;

            case "NotificationReports":
                Element = new Reports.ReportViewModel();
                break;

            case "ExclusionReports":
                Element = new Reports.ReportViewModel(1);
                break;

            case "AdminConfig":
                Element = new Admin.ConfigurationViewModel();
                break;

            case "CategoryMaster":
                Element = new Admin.CategoryMasterViewModel();
                break;

            case "CategoryMapping":
                Element = new Admin.CategoryMappingViewModel();
                break;

            case "Diagnostics":
                Element = new Admin.DiagnosticsViewModel();
                break;

            case "Blank":
                Element = new BlankViewModel();
                break;
            }
            StatusMessage = Utilities.GetResourceValue("DefaultStatus");
        }
예제 #26
0
 public StartupWindow(FileSystemInfo map, IDictionary <AntProxy, AppDomain> ants, bool isDebug = false)
 {
     InitializeComponent();
     DataContext = new StartupViewModel(this, map, ants, isDebug);
     KeyUp      += OnKeyUp;
 }
예제 #27
0
        public ActionResult Startup(StartupViewModel vmodel)
        {
            try
            {
                var setupConfig = SetupHelper.LoadSetup();
                setupConfig.StartupType = vmodel.StartupType;

                if (vmodel.StartupType == StartupTypeText.Url)
                {
                    setupConfig.StartupData = vmodel.Url;
                    setupConfig.StartupUrl  = vmodel.Url;
                }
                else if (vmodel.StartupType == StartupTypeText.Page)
                {
                    setupConfig.StartupData = vmodel.PageId;
                    var page = _pageService.Get(long.Parse(vmodel.PageId));
                    if (page == null)
                    {
                        ShowMessage("Page not found.", MessageType.Error);
                    }
                    var pageDetails = page.PageDetails.Where(x => x.Language == GlobalContext.WebSite.Language).FirstOrDefault();
                    if (pageDetails == null)
                    {
                        ShowMessage("Page for default language not found.", MessageType.Error);
                    }
                    else
                    {
                        setupConfig.StartupUrl = "/" + pageDetails.Slug;
                    }
                }
                else if (vmodel.StartupType == StartupTypeText.Post)
                {
                    setupConfig.StartupData = vmodel.PostId;
                    var post = _postService.Get(long.Parse(vmodel.PostId));
                    if (post == null)
                    {
                        ShowMessage("Post not found.", MessageType.Error);
                    }
                    var postDetails = post.PostDetails.Where(x => x.Language == GlobalContext.WebSite.Language).FirstOrDefault();
                    if (postDetails == null)
                    {
                        ShowMessage("Post for default language not found.", MessageType.Error);
                    }
                    else
                    {
                        setupConfig.StartupUrl = "/Post/" + postDetails.Slug;
                    }
                }
                else if (vmodel.StartupType == StartupTypeText.Category)
                {
                    setupConfig.StartupData = vmodel.CategoryId;
                    var category = _categoryService.Get(long.Parse(vmodel.CategoryId));
                    if (category == null)
                    {
                        ShowMessage("Category not found.", MessageType.Error);
                    }
                    var categoryDetails = category.CategoryDetails.Where(x => x.Language == GlobalContext.WebSite.Language).FirstOrDefault();
                    if (categoryDetails == null)
                    {
                        ShowMessage("Category for default language not found.", MessageType.Error);
                    }
                    else
                    {
                        setupConfig.StartupUrl = "/Category/" + categoryDetails.Slug;
                    }
                }
                else if (vmodel.StartupType == StartupTypeText.Module)
                {
                    setupConfig.StartupData = vmodel.ModuleSiteMenuUrl;
                    setupConfig.StartupUrl  = vmodel.ModuleSiteMenuUrl;
                }
                else
                {
                    setupConfig.StartupType = StartupTypeText.Url;
                    setupConfig.StartupData = "/CmsHome";
                    setupConfig.StartupUrl  = "/CmsHome";
                }

                if (setupConfig.StartupData.Trim('/') == "" || setupConfig.StartupData.Trim().Trim('/').ToLower() == "home")
                {
                    ShowMessage("Incorrect value", MessageType.Error);
                    return(View(vmodel));
                }

                SetupHelper.UpdateSetup(setupConfig);
                GlobalContext.SetupConfig = setupConfig;
            }
            catch (Exception ex)
            {
                return(View(vmodel));
            }

            ShowMessage("Config save successful.", MessageType.Success);
            var model = PrepareStartupViewData();

            return(View(model));
        }
예제 #28
0
        public StartupPage()
        {
            InitializeComponent();

            BindingContext = new StartupViewModel(Navigation);
        }
예제 #29
0
 public StartupPage()
 {
     this.InitializeComponent();
     StartupViewModel          = App.Container.Resolve <StartupViewModel>();
     this.MainGrid.DataContext = StartupViewModel.LoginViewModel;
 }
예제 #30
0
        public ActionResult Index()
        {
            var vm = new StartupViewModel();

            return(View(vm));
        }
예제 #31
0
 public StartupViewController()
 {
     ViewModel = new StartupViewModel(
         Mvx.Resolve <IAccountsService>(),
         Mvx.Resolve <IApplicationService>());
 }