public void OnClicked(object sender, SelectedItemChangedEventArgs e) { var selectedCommandParameter = (CommandParameter)e.SelectedItem; MainMenuViewModel mmvm = (MainMenuViewModel)App.Current.Properties[Convert.ToString(App.ObjectsInPropertyDictionary.MainMenuViewModel)]; mmvm.DeleteCommand(selectedCommandParameter); }
public MainShellViewModel(IResultFactory resultFactory, IEventAggregator eventAggregator, IPersistanceManager persistanceManager, ISettingsManager settingsManager, MainMenuViewModel mainMenuViewModel, ConsoleViewModel consoleViewModel, ErrorViewModel errorViewModel, WatchesViewModel watchesViewModel, IFileSystem fileSystem, ScriptDialogStrategy scriptDialogStrategy, IPaths paths ) : base(resultFactory) { this.eventAggregator = eventAggregator; eventAggregator.Subscribe(this); this.persistanceManager = persistanceManager; this.fileSystem = fileSystem; this.scriptDialogStrategy = scriptDialogStrategy; this.paths = paths; Scripts = new BindableCollection <ScriptEditorViewModel>(); Tools = new BindableCollection <PanelViewModel> { consoleViewModel, errorViewModel, watchesViewModel }; Menu = mainMenuViewModel; Menu.Plugins = settingsManager.ListConfigurablePluginSettings().Select(ps => new PluginSettingsMenuViewModel(ps)); Menu.HelpFiles = settingsManager.ListPluginSettingsWithHelpFile().Select(ps => new PluginHelpFileViewModel(ps)).ToList(); Menu.Views = Tools; DisplayName = "FreePIE - Programmable Input Emulator"; }
public override void CreateSut() { sut = new MainMenuViewModel(ViewModelService.Object, nbpService.Object, zkSzczegolyUC.Object, zapotrzebowanieVM.Object); }
public MainMenuView() { InitializeComponent(); model = new MainMenuViewModel(); DataContext = model; PlayBackgroundMusic(); }
public PartialViewResult MainMenu(int skillId) { if (skillId == 0) { return(null); } MainMenuViewModel model = new MainMenuViewModel() { SkillId = skillId }; string userId = User.Identity.GetUserId(); using (AlexaSkillEntities db = new AlexaSkillEntities()) { Context.Skill skill = db.Skills.FirstOrDefault(x => x.Id == skillId && x.UserId == userId); if (skill == null) { return(null); } foreach (Intent intent in skill.Intents.OrderBy(x => x.Name)) { model.Intents.Add(intent.Id, intent.Name); } } return(PartialView(model)); }
public override void ExecuteResult(ControllerContext context) { base.ExecuteResult(context); _newsRepository.IncreaseNumOfView(_articleId); var mainViewModel = new HomePageViewModel(); var menuViewModel = new MainMenuViewModel(); var footerViewModel = new FooterViewModel(); var mainPageViewModel = new MainPageViewModel(); var categories = _categoryRepository.GetCategories(); var subscriptions = _categoryRepository.GetUserCategories(_userIdentity.Name); //get only current user subscriptions if (categories != null && categories.Any()) { //left menu with subscribed categories menuViewModel.Categories = subscriptions.ToList(); footerViewModel.Categories = categories.ToList(); } mainPageViewModel.LeftColumn = this.BindingDataForDetailsLeftColumnViewModel(_articleId); mainPageViewModel.RightColumn = this.BindingDataForMainPageRightColumnViewModel(); menuViewModel.SiteTitle = string.Format(SITE_TITLE, ((DetailsLeftColumnViewModel)mainPageViewModel.LeftColumn).CurrentArticle.NewsContent.Title); mainViewModel.DashBoard = new DashboardViewModel(); mainViewModel.MainMenu = menuViewModel; mainViewModel.MainPage = mainPageViewModel; //article content mainViewModel.Footer = footerViewModel; GetViewResult(mainViewModel).ExecuteResult(context); }
public FileListingController(FileListingViewModel ViewModel, NotesViewModel NotesViewModel, MainMenuViewModel MenuViewModel, IMessenger Messenger, IMapper Mapper, IUpkFileRepository Repository, IUpkFileRemoteRepository RemoteRepository) { viewModel = ViewModel; notesViewModel = NotesViewModel; menuViewModel = MenuViewModel; rebuildController = menuViewModel.rebuildController; messenger = Messenger; mapper = Mapper; repository = Repository; remoteRepository = RemoteRepository; viewModel.Files = new ObservableCollection <FileViewEntity>(); viewModel.FilterText = String.Empty; viewModel.PropertyChanged += onViewModelPropertyChanged; menuViewModel.PropertyChanged += onMenuViewModelPropertyChanged; allFiles = new List <DomainUpkFile>(); allFileEntities = new List <FileViewEntity>(); }
public MainMenuWindow(Window window, out MainMenuViewModel viewmodel) { InitializeComponent(); isclosetrans = 0; this.fatherwindow = window; mmbuttons.Add(ToBsManagerButton); mmbuttons.Add(ToRoomState); DomainTitleDocPanels.Add(BsManagerMenu); DomainTitleDocPanels.Add(RoomStateMenu); double x = SystemParameters.WorkArea.Width; //得到屏幕工作区域宽度 double y = SystemParameters.WorkArea.Height; //得到屏幕工作区域高度 //this.ShowInTaskbar = false; this.Height = y; this.Width = x; //获取当前用户并分配权限 Person nowPerson = XmlHelper.SelectNowPerson(); string domains_string = ""; using (RetailContext context = new RetailContext()) { domains_string = context.PersonTypes.Where(t => t.Name == nowPerson.Type).SingleOrDefault().Domains; } string[] domains_strings = domains_string.Split(','); int cnd = 1; if (domains_string == "all") { for (int i = 0; i < mmbuttons.Count(); i++) { mmbuttons[i].Visibility = Visibility.Visible; mmbuttons[i].SetValue(Grid.RowProperty, cnd++); } } else { for (int i = 0; i < mmbuttons.Count(); i++) { if (domains_strings.Contains((i + 1).ToString())) { mmbuttons[i].Visibility = Visibility.Visible; mmbuttons[i].SetValue(Grid.RowProperty, cnd++); } else { mmbuttons[i].Visibility = Visibility.Hidden; } } } //设置存在containerpage中的tancontroller的frame fatherframe.Width = x - 80; fatherframe.Height = y - 70; viewmodel = new MainMenuViewModel(this); this.DataContext = viewmodel; }
public MainShellViewModel(IResultFactory resultFactory, IEventAggregator eventAggregator, IPersistanceManager persistanceManager, ISettingsManager settingsManager, MainMenuViewModel mainMenuViewModel, IEnumerable <PanelViewModel> panels, IFileSystem fileSystem, ScriptDialogStrategy scriptDialogStrategy, IPaths paths, IParser parser, IPortable portable ) : base(resultFactory) { this.eventAggregator = eventAggregator; eventAggregator.Subscribe(this); this.persistanceManager = persistanceManager; this.settingsManager = settingsManager; this.fileSystem = fileSystem; this.scriptDialogStrategy = scriptDialogStrategy; this.paths = paths; this.parser = parser; Scripts = new BindableCollection <ScriptEditorViewModel>(); Tools = new BindableCollection <PanelViewModel>(panels); Menu = mainMenuViewModel; Menu.Plugins = settingsManager.ListConfigurablePluginSettings().Select(ps => new PluginSettingsMenuViewModel(ps)); Menu.HelpFiles = settingsManager.ListPluginSettingsWithHelpFile().Select(ps => new PluginHelpFileViewModel(ps)).ToList(); Menu.Views = Tools; DisplayName = string.Format("FreePIE - Programmable Input Emulator{0}", portable.IsPortable ? " (Portable mode)" : null); }
public MainShellViewModel(IResultFactory resultFactory, IEventAggregator eventAggregator, IPersistanceManager persistanceManager, ISettingsManager settingsManager, MainMenuViewModel mainMenuViewModel, MainToolBarViewModel mainToolBarViewModel, IEnumerable <PanelViewModel> panels, IFileSystem fileSystem, ProfileDialogStrategy profileDialogStrategy, IPaths paths, IParser parser, IPortable portable ) : base(resultFactory) { this.eventAggregator = eventAggregator; this.eventAggregator.Subscribe(this); this.persistanceManager = persistanceManager; this.settingsManager = settingsManager; this.fileSystem = fileSystem; this.profileDialogStrategy = profileDialogStrategy; this.paths = paths; this.parser = parser; Profiles = new BindableCollection <MonitorViewModel>(); Tools = new BindableCollection <PanelViewModel>(panels); Menu = mainMenuViewModel; Menu.Views = Tools; ToolBar = mainToolBarViewModel; DisplayName = "CockpitBuilder"; }
private void MainPage_Loaded(object sender, RoutedEventArgs e) { MainMenuViewModel viewModel = new MainMenuViewModel(); viewModel.BusyMode = false; DataContext = viewModel; }
private void Font_Tapped(object sender, Avalonia.Interactivity.RoutedEventArgs e) { FontFamily currentFont = (FontFamily)Application.Current.Resources["UIFont"]; if (currentFont.Name.Contains("Roboto", System.StringComparison.InvariantCultureIgnoreCase)) { // Set OpenDyslexic var newFont = Application.Current.Resources["Font_OpenDyslexic"]; Application.Current.Resources["UIFont"] = newFont; } else { // Set Roboto var newFont = Application.Current.Resources["Font_Roboto"]; Application.Current.Resources["UIFont"] = newFont; } // Rebound main menu to force render of new font TextBlock tappedTextBox = (TextBlock)sender; MainMenuViewModel dataContext = (MainMenuViewModel)tappedTextBox.DataContext; dataContext.MainDatacontext.DisplayMainMenu(); }
public ActionResult ManageMainMenu(int?mainMenuID, string operation) { MainMenuViewModel model = null; if (mainMenuID == null) { model = new MainMenuViewModel(); } else { //get Main Menu by ID model = _mainMenuBAL.GetMainMenuByID(mainMenuID.Value); } if (model == null) { ViewBag.msg = "No record found"; model = new MainMenuViewModel(); } string message = string.Empty; if (operation != null) { if (operation == AppConstants.ADDED) { message = "Sections added successfully."; } else if (operation == AppConstants.UPDATED) { message = "Sections updated successfully."; } ViewBag.Message = message; } return(View(model)); }
public MainWindowViewModel(IShell shell, ICommandManager commandManager, MainMenuViewModel mainMenu, MainToolBarTrayViewModel toolBarTray) { this.MainMenu = mainMenu ?? throw new ArgumentNullException(nameof(mainMenu)); this.Shell = shell ?? throw new ArgumentNullException(nameof(shell)); CommandManager = commandManager ?? throw new ArgumentNullException(nameof(commandManager)); ToolBarTray = toolBarTray ?? throw new ArgumentNullException(nameof(toolBarTray)); }
public List <MainMenuViewModel> GetMainMenus() { DBOperations dbOps = new DBOperations(); List <MainMenuViewModel> objs = new List <MainMenuViewModel>(); try { dbOps.ProcName = AppConstants.USP_GETMAINMENUS; dbOps.ExecuteReader(); if (!(dbOps.DataReader == null)) { using (dbOps.DataReader) { while (dbOps.DataReader.Read()) { MainMenuViewModel obj = new MainMenuViewModel { MainMenuId = Helper.HandleDBNull <int>(dbOps.DataReader[0]), Name = Helper.HandleDBNull <string>(dbOps.DataReader[1]), }; objs.Add(obj); } } } return(objs); } catch (Exception Ex) { throw Ex; } }
public MainShellViewModel(IResultFactory resultFactory, IEventAggregator eventAggregator, MainMenuViewModel mainMenuViewModel, MainToolBarTrayViewModel mainToolBarViewModel, IEnumerable <PanelViewModel> panels, ISettingsManager settingsManager, IFileSystem fileSystem, IPersistanceManager persistanceManager, IPaths paths, IPortable portable ) : base(resultFactory) { this.eventAggregator = eventAggregator; eventAggregator.Subscribe(this); this.persistanceManager = persistanceManager; this.settingsManager = settingsManager; this.fileSystem = fileSystem; this.paths = paths; Menu = mainMenuViewModel; ToolBarTray = mainToolBarViewModel; Scripts = new BindableCollection <MonitorViewModel>(); Tools = new BindableCollection <PanelViewModel>(panels); mainMenuViewModel.NewProfile(); }
public GameViewModel() { m_mainViewModel = new MainMenuViewModel(this); m_mainViewModel.OnOpenNewGameCommand += MainViewModel_OnOpenNewGameCommand; m_mainViewModel.OnOpenOptionsCommand += MainViewModel_OnOpenOptionsCommand; m_mainViewModel.OnLoadGameCommand += MainViewModel_OnLoadGameCommand; m_newGameViewModel = new NewGameViewModel(this); m_newGameViewModel.OnCloseNewGameCommand += NewGameViewModel_OnCloseNewGameCommand; m_newGameViewModel.OnStartGameCommand += NewGameViewModel_OnStartGameCommand; m_newGameViewModel.OnDisplayDurationChange += NewGameViewModel_OnDisplayDurationChange; m_newGameViewModel.OnPlayerCountChange += NewGameViewModel_OnPlayerCountChange; m_newGameViewModel.OnSessionNameChange += NewGameViewModel_OnSessionNameChange; m_newGameViewModel.OnSearchedCountChange += NewGameViewModel_OnSearchedCountChange;; m_optionsViewModel = new OptionsViewModel(this); m_optionsViewModel.OnCloseOptionsCommand += OptionsViewModel_OnCloseOptionsCommand; m_syllablesInputViewModel = new SyllablesInputViewModel(this); m_syllablesInputViewModel.OnAcceptCommand += SyllablesViewModel_OnAcceptCommand; m_incommingTransmissionViewModel = new IncommingTransmissionViewModel(this); m_incommingTransmissionViewModel.OnWaitTimePassed += IncommingTransmissionViewModel_OnWaitTimePassed; m_endScreenViewModel = new EndScreenViewModel(this); m_endScreenViewModel.OnOKCommand += EndScreenViewModel_OnOKCommand; CurrentDisplayedMenu = m_mainViewModel; }
public MainMenu() { InitializeComponent(); BindingContext = new MainMenuViewModel(); ListView = MenuItemsListView; }
public override void ExecuteResult(ControllerContext context) { base.ExecuteResult(context); var userName = _userIdentity.Name; var categories = _categoryRepository.GetCategories(); var subscribedCategories = _categoryRepository.GetUserCategories(userName).ToList();//TODO: get only current user subscriptions var mainViewModel = new HomePageViewModel(); var menuViewModel = new MainMenuViewModel(); var footerViewModel = new FooterViewModel(); var mainPageViewModel = new MainPageViewModel(); menuViewModel.SiteTitle = APP_HEADER; if (categories != null && categories.Any()) { menuViewModel.Categories = subscribedCategories; footerViewModel.Categories = categories.ToList(); } mainPageViewModel.LeftColumn = this.BindingDataForMainPageLeftColumnViewModel(); mainPageViewModel.RightColumn = this.BindingDataForMainPageRightColumnViewModel(); mainViewModel.MainMenu = menuViewModel; mainViewModel.MainPage = mainPageViewModel; mainViewModel.DashBoard = new DashboardViewModel(); mainViewModel.Footer = footerViewModel; GetViewResult(mainViewModel).ExecuteResult(context); }
public Result AddMainMenu(MainMenuViewModel model) { Result result = new Result(); DBOperations dbOps = new DBOperations(); try { NpgsqlParameter[] aParams = new NpgsqlParameter[2]; aParams[0] = new NpgsqlParameter("Name", NpgsqlTypes.NpgsqlDbType.Varchar); aParams[0].Value = model.Name; aParams[1] = new NpgsqlParameter("CreatedBy", NpgsqlTypes.NpgsqlDbType.Integer); aParams[1].Value = model.CreatedBy; int res = dbOps.ExecuteNonQuery(AppConstants.QueryConstants.AddMainMenu, aParams); if (res > 0) { result.Status = Status.Success; result.Values = res.ToString(); } else { result.Status = Status.Failure; } } catch (Exception Ex) { dbOps.Abort(); result.Status = Status.Failure; } return(result); }
public PartialViewResult Menu(int levels) { var vm = new MainMenuViewModel(); vm.MenuItems = GetMenuItems(GetRootNode(), 0, levels - 1); return(PartialView("_MainNavigation", vm)); }
private MainMenuViewModel CreateViewModel() { MainMenuViewModel mainMenuViewModel = new MainMenuViewModel(); mainMenuViewModel.AdminLoginAction += OpenAdminLoginWindow; mainMenuViewModel.UserLoginAction += OpenUserLoginWindow; return(mainMenuViewModel); }
public ActionResult MainMenu(string currentControllerName) { using (var context = dataContextFactory.CreateByUser()) { var model = new MainMenuViewModel(context.GetUser(HttpContext.User.Identity), currentControllerName); return(PartialView(model)); } }
public MainMenu() { this.InitializeComponent(); Instance = this; this.ViewModel = new MainMenuViewModel(); this.DataContext = this.ViewModel; }
private void Ohi_Tapped(object sender, Avalonia.Interactivity.RoutedEventArgs e) { TextBlock tappedTextBox = (TextBlock)sender; MainMenuViewModel dataContext = (MainMenuViewModel)tappedTextBox.DataContext; dataContext.MainDatacontext.DisplayAboutScreen(); }
public VideoPlayerViewModel(MainMenuViewModel mmvm, int?epCount, List <Episode> checkedEpisodes) { _libVlc = new LibVLC(); _mmvm = mmvm; WatchingEpisodesCount = epCount; CheckedEpisodes = checkedEpisodes; }
public MenuPage(MainMenuViewModel menuViewModel) { InitializeComponent(); _mainMenuViewModel = menuViewModel; BindingContext = _mainMenuViewModel = new MainMenuViewModel(); }
public void SetUp() { _mainMenu = new GameObject(); _mainMenuView = _mainMenu.AddComponent <MainMenuView>(); _mainMenuView.StartGameButton = _mainMenu.AddComponent <Button>(); _mainMenuViewModel = new MainMenuViewModel(); _mainMenuView.SetModel(_mainMenuViewModel); }
public LeftMenuPage() { InitializeComponent(); var menuPageViewModel = new MainMenuViewModel(); menuListView.ItemsSource = menuPageViewModel.MenuItemList; }
public static WindowObserver getObserver(MainMenuViewModel vm) { if (_instance == null) { _instance = new WindowObserver(vm); } return(_instance); }
public void Process(StringBuilder output, MerchantTribe.Commerce.MerchantTribeApplication app, dynamic viewBag, ITagProvider tagProvider, ParsedTag tag, string innerContents) { int linksPerRow = 9; string tryLinksPerRow = tag.GetSafeAttribute("linksperrow"); int temp1 = -1; if (int.TryParse(tryLinksPerRow, out temp1)) linksPerRow = temp1; if (linksPerRow < 1) linksPerRow = 1; int maxLinks = 9; int temp2 = -1; string tryMaxLinks = tag.GetSafeAttribute("maxlinks"); if (int.TryParse(tryMaxLinks, out temp2)) maxLinks = temp2; if (maxLinks < 1) maxLinks = 1; int tabIndex = 0; string tryTabIndex = tag.GetSafeAttribute("tabindex"); int.TryParse(tryTabIndex, out tabIndex); if (tabIndex < 0) tabIndex = 0; MainMenuViewModel model = new MainMenuViewModel(); model.LinksPerRow = linksPerRow; model.MaxLinks = maxLinks; //Find Categories to Display in Menu List<MerchantTribe.Commerce.Catalog.CategorySnapshot> categories = app.CatalogServices.Categories.FindForMainMenu(); int tempTabIndex = 0; foreach (var c in categories) { var l = new MainMenuViewModelLink(); l.AltText = c.MetaTitle; l.DisplayName = c.Name; l.TabIndex = tempTabIndex; l.Target = string.Empty; l.IsActive = false; l.Url = MerchantTribe.Commerce.Utilities.UrlRewriter.BuildUrlForCategory(c, app.CurrentRequestContext.RoutingContext); if (c.Bvin == SessionManager.CategoryLastId) l.IsActive = true; if (c.SourceType == MerchantTribe.Commerce.Catalog.CategorySourceType.CustomLink || c.SourceType == MerchantTribe.Commerce.Catalog.CategorySourceType.CustomPage) { if (c.CustomPageOpenInNewWindow) l.Target = "_blank"; } model.Links.Add(l); tempTabIndex += 1; } Render(output, model); }
public MainShellViewModel(IResultFactory resultFactory, IEventAggregator eventAggregator, IPersistanceManager persistanceManager, ISettingsManager settingsManager, MainMenuViewModel mainMenuViewModel, ScriptEditorViewModel scriptEditorViewModel, OutputViewModel outputViewModel) : base(resultFactory) { persistanceManager.Load(); this.eventAggregator = eventAggregator; eventAggregator.Subscribe(this); this.persistanceManager = persistanceManager; Menu = mainMenuViewModel; Menu.Plugins = settingsManager.ListConfigurablePluginSettings().Select(ps => new PluginSettingsMenuViewModel(ps)); ScriptEditor = scriptEditorViewModel; Output = outputViewModel; DisplayName = "FreePIE - Programmable Input Emulator"; }
private string Render(StringBuilder sb, MainMenuViewModel model) { // Limit number of links int stopCount = model.Links.Count - 1; if ((model.MaxLinks > 0) && ((model.MaxLinks - 1) < stopCount)) { stopCount = (model.MaxLinks - 1); } if (model.Links.Count > 0) { sb.Append("<ul>"); for (int i = 0; i <= stopCount; i++) { var link = model.Links[i]; sb.Append("<li><a href=\"" + link.Url + "\" title=\"" + HttpUtility.HtmlEncode(link.AltText) + "\""); if(link.IsActive) { sb.Append(" class=\"activemainmenuitem\""); } if (link.Target.Length > 0) { sb.Append(" target=\"" + link.Target + "\""); } sb.Append("><span>" + HttpUtility.HtmlEncode(link.DisplayName) + "</span></a></li>"); // Move to Next Row if Not Last Item int endOfRowCount = (i + 1) % model.LinksPerRow; if ((endOfRowCount == 0) && (i < stopCount)) { sb.Append("</ul><ul>"); } } sb.Append("</ul>"); } return sb.ToString(); }
public MainMenuView(MainMenuViewModel viewModel) { this.DataContext = viewModel; InitializeComponent(); }