本文整理汇总了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;
}
示例2: CreateMain
/// <summary>
/// Provides a deterministic way to create the Main property.
/// </summary>
public static void CreateMain()
{
if (_main == null)
{
_main = new MainViewModel();
}
}
示例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);
}
示例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;
}
示例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();
}
示例6: HomePage
public HomePage()
{
ViewModel = new MainViewModel(8);
InitializeComponent();
NavigationCacheMode = NavigationCacheMode.Required;
}
示例7: MainWindow
public MainWindow(string imagePath)
{
InitializeComponent();
mainVM = new MainViewModel(this.canvas, imagePath);
this.DataContext = mainVM;
moving = false;
}
示例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();
}
示例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));
}
}
}
示例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
}
示例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;
}
};
}
示例12: MainPage
public MainPage()
{
this.InitializeComponent();
mvm = MainViewModel.Instance;
DataContext = mvm;
//System.Diagnostics.Debug.WriteLine(MainViewModel.GetInstanceOf().HueLampen.Count);
}
示例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
}
};
}
示例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);
}
示例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);
}