当前位置: 首页>>代码示例>>C#>>正文


C# MainViewModel类代码示例

本文整理汇总了C#中MainViewModel的典型用法代码示例。如果您正苦于以下问题:C# MainViewModel类的具体用法?C# MainViewModel怎么用?C# MainViewModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MainViewModel类属于命名空间,在下文中一共展示了MainViewModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PrepareMainViewModel

 private MainViewModel PrepareMainViewModel(ClientStorage clientStorage, ProjectStorage projectStorage)
 {
     var clientListViewModel = new ClientListViewModel(clientStorage);
     var projectListViewModel = new ProjectListViewModel(projectStorage);
     var mainViewModel = new MainViewModel(clientListViewModel, projectListViewModel);
     return mainViewModel;
 }
开发者ID:Cheboksarinov,项目名称:ClientsAndProjects,代码行数:7,代码来源:Bootstrapper.cs

示例2: CreateMain

 /// <summary>
 /// Provides a deterministic way to create the Main property.
 /// </summary>
 public static void CreateMain()
 {
     if (_main == null)
     {
         _main = new MainViewModel();
     }
 }
开发者ID:fabmoll,项目名称:SimpleTodo,代码行数:10,代码来源:ViewModelLocator.cs

示例3: SaveCommandExecutedWhereSaveCallbackIsNullExpectedNoException

        public void SaveCommandExecutedWhereSaveCallbackIsNullExpectedNoException()
        {
            Configuration.Settings.Configuration config = new Configuration.Settings.Configuration("localhost");
            MainViewModel mainViewModel = new MainViewModel(config.ToXml(), null, null, null);

            mainViewModel.SaveCommand.Execute(null);
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:7,代码来源:MainViewModelTests.cs

示例4: MainWindow

        public MainWindow()
        {
            _mainViewModel = new MainViewModel();
            DataContext = _mainViewModel;

            InitializeComponent();
            AddNewLocation.Click += AddNewLocationClick;
            DeleteLocation.Click += DeleteLocationOnClick;

            AddNewSwitch.Click += AddNewSwitchClick;
            DeleteSwitch.Click += DeleteSwitchOnClick;
            AddNewLight.Click += AddNewLightClick;
            DeleteLight.Click += DeleteLightOnClick;

            AssignSwitchToLocation.Click += AssignSwitchToLocationClick;
            RemoveSwitchFromLocation.Click += RemoveSwitchFromLocationOnClick;

            AssignSwitchToLight.Click += AssignSwitchToLightClick;
            RemoveLightFromLocation.Click += RemoveLightFromLocationOnClick;

            AssignLightToLocation.Click += AssignLightToLocationClick;
            RemoveSwitchFromLight.Click += RemoveSwitchFromLightOnClick;

            AddNewArduinoGroup.Click += AddNewArduinoGroup_Click;
            DeleteArduinoGroup.Click += DeleteArduinoGroupOnClick;

            AssignLocationToArduinoGroup.Click += AssignLocationToArduinoGroupOnClick;
            RemoveLocationFromArduinoGroup.Click += RemoveLocationFromArduinoGroupOnClick;

            Open.Click += OpenOnClick;
            Save.Click += SaveOnClick;
            Generate.Click += GenerateOnClick;
            Print.Click += PrintOnClick;
        }
开发者ID:ideic,项目名称:Smarthome,代码行数:34,代码来源:MainWindow.xaml.cs

示例5: MapsViewModel

        public MapsViewModel(MainViewModel parent)
        {
            this.Parent = parent;

            var allMaps = parent.Realm.GameData.GetSheet<Map>();
            _Maps = allMaps.Where(m => m.TerritoryType != null && m.TerritoryType.Key > 1 && m.PlaceName != null && m.PlaceName.Key != 0 && m.RegionPlaceName != null && m.RegionPlaceName.Key != 0).ToArray();
        }
开发者ID:KevinAllenWiegand,项目名称:SaintCoinach,代码行数:7,代码来源:MapsViewModel.cs

示例6: HomePage

        public HomePage()
        {
            ViewModel = new MainViewModel(8);            
            InitializeComponent();

            NavigationCacheMode = NavigationCacheMode.Required;
        }
开发者ID:mbsabbanban,项目名称:baby-mayas-adventures,代码行数:7,代码来源:HomePage.xaml.cs

示例7: MainWindow

 public MainWindow(string imagePath)
 {
     InitializeComponent();
     mainVM = new MainViewModel(this.canvas, imagePath);
     this.DataContext = mainVM;
     moving = false;
 }
开发者ID:kon0524,项目名称:ImageViewer,代码行数:7,代码来源:MainWindow.xaml.cs

示例8: Run

        public static void Run()
        {
            var window = new MainWindow();

            var viewModel = new MainViewModel(
                Properties.Settings.Default.LastFolder);

            viewModel.OnFolderChanged += (s, e) =>
            {
                Properties.Settings.Default.LastFolder = e.Item;

                Properties.Settings.Default.Save();
            };

            viewModel.OnLogon += (s, e) =>
            {
                var uri = LogonRunner.Run(window);

                if (uri != null)
                    viewModel.HandleLogon(uri);
            };

            window.DataContext = viewModel;

            window.Show();
        }
开发者ID:squideyes,项目名称:BlobSmart,代码行数:26,代码来源:MainRunner.cs

示例9: OutputWindow

 public OutputWindow(DFABuilder dfaBuilder, bool stepByStepMode)
 {
     InitializeComponent();
     _dfa = dfaBuilder.Dfa;
     if (_dfa.States.Count >= 25)
     {
         MessageBox.Show("Warning! There are more than 25 states generated. The proper working of the application is not guaranteed.");
     }
     _mainViewModel = new MainViewModel();
     _dfaBuilder = dfaBuilder;
     this.DataContext = _mainViewModel;
     _steps = dfaBuilder.Steps;
     if (stepByStepMode)
     {
         btnNextStep.IsEnabled = true;
     }
     else
     {
         btnNextStep.IsEnabled = false;
         generateContentDot(_steps.Count);
         BitmapImage bmp = dot2bmp(_beginDot + _contentDot + _endDot);
         imgGraph.Source = bmp;
         foreach (Transition t in _dfa.Transitions)
         {
             _mainViewModel.Transitions.Add(t);
         }
         foreach (State s in _dfa.States)
         {
             _mainViewModel.Labels.Add(Tuple.Create(s.QLabel, s.RegexLabel));
         }
     }
 }
开发者ID:pmichna,项目名称:Finite,代码行数:32,代码来源:OutputWindow.xaml.cs

示例10: LoadWSOFile

		public static void LoadWSOFile(string filePath, MainViewModel viewModel)
		{
			// Load user's current options and make a copy.
			BuildModel(viewModel, false);

			IVisitorWithContext visitor = new XmlReadVisitor();
			UIOptionRootType optionsRoot = new UIOptionRootType();
			optionsRoot.Accept(visitor, filePath);

			foreach (var cat in optionsRoot.Categories)
			{
				foreach (var subCat in cat.SubCategories)
				{
					foreach (var opt in subCat.Options)
					{
						if (opt is UIOptionGroupType)
						{
							LoadGroup(viewModel, opt);
						}
						IOption targetOpt = viewModel.FindOption(opt.Name);
						if (targetOpt != null)
						{
							LoadOption(targetOpt, opt);
						}
					}
				}
			}

			// We need to pass the OptionsRoot object to somebody who can display it in UI
		}
开发者ID:killbug2004,项目名称:WSProf,代码行数:30,代码来源:OptionsLoadSaveHelper.cs

示例11: MainPage

        public MainPage()
        {
            this.InitializeComponent();
            this.NavigationCacheMode = NavigationCacheMode.Enabled;

            // set data context
            _mainVm = SingletonLocator.Get<MainViewModel>();
            DataContext = _mainVm;

            // set initial items panel template (from settings)
            var iptIndex = new AppSettings().ItemsControlViewInfoIndex;
            SetItemsPanelTemplate(iptIndex);

            Loaded += MainPage_OnLoaded;

            // listen for back-button
            HardwareButtons.BackPressed += async (sender, args) =>
            {
                if (_mainVm.IsSortingControlVisible)
                {
                    _mainVm.ToggleSorterControlVisibility();
                    await _mainVm.ApplySortAsync();
                    args.Handled = true;
                }
            };
        }
开发者ID:Biocodr,项目名称:HearthstoneCards,代码行数:26,代码来源:MainPage.xaml.cs

示例12: MainPage

 public MainPage()
 {
     this.InitializeComponent();
     mvm = MainViewModel.Instance;
     DataContext = mvm;          
     //System.Diagnostics.Debug.WriteLine(MainViewModel.GetInstanceOf().HueLampen.Count);            
 }
开发者ID:worms618,项目名称:HueLampTi2.2,代码行数:7,代码来源:MainPage.xaml.cs

示例13: Issue1875

		public Issue1875()
		{
			Button loadData = new Button { Text = "Load", HorizontalOptions = LayoutOptions.FillAndExpand };
			ListView mainList = new ListView {
				VerticalOptions = LayoutOptions.FillAndExpand,
				HorizontalOptions = LayoutOptions.FillAndExpand
			};

			mainList.SetBinding (ListView.ItemsSourceProperty, "Items");

			_viewModel = new MainViewModel ();
			BindingContext = _viewModel;
			loadData.Clicked += async (sender, e) => {
				await LoadData ();
			};

			mainList.ItemAppearing += OnItemAppearing;

			Content = new StackLayout {
				Children = {
					loadData,
					mainList
				}
			};
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:25,代码来源:Issue1875.cs

示例14: MobileTransactionsViewModel

        public MobileTransactionsViewModel(MainViewModel mainViewModel)
        {
            _mainViewModel = mainViewModel;

            FromDateFilter = DateTime.Today.AddDays(-14);
            ThroughDateFilter = DateTime.Today.AddDays(1);

            SalesmanFilter = mainViewModel.Context.Salesmen.ToList();
            SalesmanFilter.Insert(0, new Salesman { Contragent = new Contragent { LastName = "Any" } });
            SelectedSalesmanFilter = SalesmanFilter.FirstOrDefault();

            //ClientsFilter = mainViewModel.Context.Clients.ToList().Select(x => x.Contragent).ToList();
            //ClientsFilter.Insert(0, new Contragent { LastName = "Any" });
            //SelectedClientFilter = ClientsFilter.FirstOrDefault();

            ClientsFilter = mainViewModel.Context.Clients.ToList().Select(x => x.Contragent.LastName).ToList();

            MobileTransactions = new ObservableCollection<MobileTransactionViewModel>(GetMobileTransactions(mainViewModel.Context));
            MobileTransactionsView = CollectionViewSource.GetDefaultView(MobileTransactions);
            MobileTransactionsView.Filter = Filter;

            AddCommand = new DelegateCommand(Add);
            CloseAddDialogCommand = new DelegateCommand(() => AddDialogViewModel = null);

            DeleteCommand = new DelegateCommand(Delete, () => SelectedTransaction != null);

            FilterCommand = new DelegateCommand(MobileTransactionsView.Refresh);
        }
开发者ID:didovych,项目名称:BroWPF,代码行数:28,代码来源:MobileTransactionsViewModel.cs

示例15: ApplicationController

        public ApplicationController(CompositionContainer container, IPresentationService presentationService,
            IMessageService messageService, ShellService shellService, ProxyController proxyController, DataController dataController)
        {
            InitializeCultures();
            presentationService.InitializeCultures();

            this.container = container;
            this.dataController = dataController;
            this.proxyController = proxyController;
            this.messageService = messageService;

            this.dataService = container.GetExportedValue<IDataService>();

            this.floatingViewModel = container.GetExportedValue<FloatingViewModel>();
            this.mainViewModel = container.GetExportedValue<MainViewModel>();
            this.userBugsViewModel = container.GetExportedValue<UserBugsViewModel>();
            this.teamBugsViewModel = container.GetExportedValue<TeamBugsViewModel>();

            shellService.MainView = mainViewModel.View;
            shellService.UserBugsView = userBugsViewModel.View;
            shellService.TeamBugsView = teamBugsViewModel.View;

            this.floatingViewModel.Closing += FloatingViewModelClosing;

            this.showMainWindowCommand = new DelegateCommand(ShowMainWindowCommandExcute);
            this.englishCommand = new DelegateCommand(() => SelectLanguage(new CultureInfo("en-US")));
            this.chineseCommand = new DelegateCommand(() => SelectLanguage(new CultureInfo("zh-CN")));
            this.settingCommand = new DelegateCommand(SettingDialogCommandExcute, CanSettingDialogCommandExcute);
            this.aboutCommand = new DelegateCommand(AboutDialogCommandExcute);
            this.exitCommand = new DelegateCommand(ExitCommandExcute);
        }
开发者ID:alibad,项目名称:Bugger,代码行数:31,代码来源:ApplicationController.cs


注:本文中的MainViewModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。