• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# MainViewModel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: RepairedToRepairProductDialogViewModel

        public RepairedToRepairProductDialogViewModel(MainViewModel mainViewModel)
        {
            _mainViewModel = mainViewModel;
            _repairedProduct = mainViewModel.ToRepairProductsViewModel.SelectedProduct;

            RepairedProductCommand = new DelegateCommand(RepairedProduct, Validate);
        }
开发者ID:didovych,项目名称:BroWPF,代码行数:7,代码来源:RepairedToRepairProductDialogViewModel.cs


示例17: ApplicationController

        public ApplicationController(IEnvironmentService environmentService, IPresentationService presentationService, ShellService shellService,
            Lazy<FileController> fileController, Lazy<RichTextDocumentController> richTextDocumentController, Lazy<PrintController> printController,
            Lazy<ShellViewModel> shellViewModel, Lazy<MainViewModel> mainViewModel, Lazy<StartViewModel> startViewModel)
        {
            // Upgrade the settings from a previous version when the new version starts the first time.
            if (Settings.Default.IsUpgradeNeeded)
            {
                Settings.Default.Upgrade();
                Settings.Default.IsUpgradeNeeded = false;
            }

            // Initializing the cultures must be done first. Therefore, we inject the Controllers and ViewModels lazy.
            InitializeCultures();
            presentationService.InitializeCultures();

            this.environmentService = environmentService;
            this.fileController = fileController.Value;
            this.richTextDocumentController = richTextDocumentController.Value;
            this.printController = printController.Value;
            this.shellViewModel = shellViewModel.Value;
            this.mainViewModel = mainViewModel.Value;
            this.startViewModel = startViewModel.Value;

            shellService.ShellView = this.shellViewModel.View;
            this.shellViewModel.Closing += ShellViewModelClosing;
            this.exitCommand = new DelegateCommand(Close);
        }
开发者ID:bensenplus,项目名称:breeze,代码行数:27,代码来源:ApplicationController.cs


示例18: ConstructorSuccess

		public void ConstructorSuccess()
		{
			InitializeDependencies ();
			var viewModel = new MainViewModel (_dataClientMock.Object, _appConfigMock.Object);

			Assert.IsNotNull (viewModel);
		}			
开发者ID:james-alt,项目名称:demos,代码行数:7,代码来源:MainViewModelTests.cs


示例19: SaveOptions

		public static bool SaveOptions(OptionsFileType fileType, string filePath, MainViewModel viewmodel, OSPlatformEnum osPlatform, RegistryTargetEnum registryTarget, DeploymentTypeEnum deploymentType)
		{
			bool result = false;
			switch (fileType)
			{
			case OptionsFileType.ADM:
				if (deploymentType == DeploymentTypeEnum.New)
				{
					result = SaveCleanADMFile(filePath, viewmodel, osPlatform, registryTarget);
				}
				else
				{
					result = SaveADMFile(filePath, viewmodel, osPlatform, registryTarget);
				}
				break;
			case OptionsFileType.REG:
				if (deploymentType == DeploymentTypeEnum.New)
				{
					result = SaveCleanREGFile(filePath, viewmodel, osPlatform, registryTarget);
				}
				else
				{
					result = SaveREGFile(filePath, viewmodel, osPlatform, registryTarget);
				}
				break;
			case OptionsFileType.WSO:
				result = SaveWSOFile(filePath, viewmodel);
				break;
			}
			return result;
		}
开发者ID:killbug2004,项目名称:WSProf,代码行数:31,代码来源:OptionsLoadSaveHelper.cs


示例20: WindowClosed_WillStoreCurrentWindowPositionToWindowConfig_Always

        public void WindowClosed_WillStoreCurrentWindowPositionToWindowConfig_Always()
        {
            var mainVM = new MainViewModel();
            var configGuard = new ConfigurableWindowGuard();
            var win1 = new Mock<IConfigurableWindow>();
            var win2 = new Mock<IConfigurableWindow>();
            configGuard.Init(mainVM);
            var winConfig1 = new Fake_WindowConfiguration("win1");
            var winConfig2 = new Fake_WindowConfiguration("win2");
            var win1Rect = new Rect(10, 20, 100, 200);
            var win2Rect = new Rect(30, 40, 300, 400);
            win1.Setup(window => window.GetPlacement()).Returns(win1Rect);
            win2.Setup(window => window.GetPlacement()).Returns(win2Rect);
            win1.Setup(window => window.GetAlwaysOnTop()).Returns(false);
            win2.Setup(window => window.GetAlwaysOnTop()).Returns(false);
            configGuard.RegisterConfigurableWindow(win1.Object, winConfig1);
            configGuard.RegisterConfigurableWindow(win2.Object, winConfig2);

            win1.Raise(window => window.ConfigurableWindowClosed += null, EventArgs.Empty);
            win2.Raise(window => window.ConfigurableWindowClosed += null, EventArgs.Empty);

            Assert.AreEqual((int)win1Rect.Left,   winConfig1.SettingsSaved["Left"]);
            Assert.AreEqual((int)win1Rect.Top,    winConfig1.SettingsSaved["Top"]);
            Assert.AreEqual((int)win1Rect.Width,  winConfig1.SettingsSaved["Width"]);
            Assert.AreEqual((int)win1Rect.Height, winConfig1.SettingsSaved["Height"]);
            Assert.AreEqual(0 /*false*/, winConfig1.SettingsSaved["IsTopMostWindow"]);
            Assert.AreEqual((int)win2Rect.Left,   winConfig2.SettingsSaved["Left"]);
            Assert.AreEqual((int)win2Rect.Top,    winConfig2.SettingsSaved["Top"]);
            Assert.AreEqual((int)win2Rect.Width,  winConfig2.SettingsSaved["Width"]);
            Assert.AreEqual((int)win2Rect.Height, winConfig2.SettingsSaved["Height"]);
            Assert.AreEqual(0 /*false*/, winConfig2.SettingsSaved["IsTopMostWindow"]);
        }
开发者ID:kurattila,项目名称:Cider-x64,代码行数:32,代码来源:ConfigurableWindowGuard_Test.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MainWindow类代码示例发布时间:2022-05-24
下一篇:
C# MainPage类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap