本文整理汇总了C#中IScanner.Scan方法的典型用法代码示例。如果您正苦于以下问题:C# IScanner.Scan方法的具体用法?C# IScanner.Scan怎么用?C# IScanner.Scan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IScanner
的用法示例。
在下文中一共展示了IScanner.Scan方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CategoriesListViewModel
public CategoriesListViewModel(IProductService service, INavigationService navi, IScanner scanner)
{
_service = service;
_navi = navi;
_scanner = scanner;
Items = new NotifyTaskCompletion<List<Product>>(_service.GetProducts());
Categories = new NotifyTaskCompletion<List<string>>(_service.GetCategories());
NavigateToCategory = new RelayCommand<string>(async cat =>
{
var items = (await _service.GetProductsForCategory(cat))
.OrderByDescending(i => i.Rating)
.ToList();
if (items != null && items.Any())
{
var page = App.GetProductsListPage(items, cat);
await _navi.PushAsync(page);
}
else
{
await _navi.DisplayAlert("Error", "There are no items in the category " + cat);
}
});
_searchCommand = new RelayCommand(Search, () => !string.IsNullOrWhiteSpace(SearchTerm));
ScanCommand = new RelayCommand(async () =>
{
var result = await _scanner.Scan();
SearchTerm = result.Text;
Search();
});
}
示例2: CategoriesListViewModel
public CategoriesListViewModel(IProductService service, IAppNavigation navi, IScanner scanner, LogOutCommand logOut)
{
_service = service;
_navi = navi;
_scanner = scanner;
_logOut = logOut;
MessagingCenter.Subscribe<Category>(this, Messages.NavigateTo, NavigateToCategory);
_searchCommand = new Command(Search, () => !string.IsNullOrWhiteSpace(SearchTerm));
ScanCommand = new Command(async () =>
{
var result = await _scanner.Scan();
SearchTerm = result.Text;
Search();
});
AboutCommand = new Command(async () => await _navi.ShowAbout());
Categories = new NotifyTaskCompletion<List<CategoryViewModel>>(GetCategories());
}
示例3: AssessmentDetailPage
public AssessmentDetailPage(Opdracht opdracht)
{
contactpersoon = DataController.Instance.GetPersons()
[
DataController.Instance.GetCompanyPersons().Where(t => t.BedrijfID == opdracht.BedrijfID).ToList().Count > 0 ?
DataController.Instance.GetCompanyPersons().Where(t => t.BedrijfID == opdracht.BedrijfID).ToList()[0].PersoonID -1 :
0
];
formattedAddress = DataController.Instance.FormattedAddress(opdracht.Adres);
prestatielijst = DataController.Instance.GetAchievementsFromAssessment (opdracht);
if (prestatielijst.Count == 0) {
Prestatie presatie = new Prestatie();
presatie.Aanvang = DateTime.Now;
presatie.Duur = 0;
presatie.OpdrachtID = opdracht.ID;
DataController.Instance.Insert(presatie);
SyncController.Instance.SyncNeeded();
prestatielijst.Add (presatie);
}
Title = "Opdracht: " + opdracht.ID;
Padding = new Thickness (10, 10, 10, 10);
scanner = DependencyService.Get<IScanner> ();
BackgroundColor = Color.White;
generalTermsLayout = new StackLayout ();
articleLayout = new StackLayout ();
reportLayout = new StackLayout ();
lblGeneralTerms = new Label {
Text = "Algemene info",
TextColor = Color.Black,
FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label)),
FontAttributes = FontAttributes.Bold
};
lblCustommerName = new Label {
Text = "Naam: "+ DataController.Instance.GetCompanys()[opdracht.BedrijfID].Naam,
TextColor = Color.Black
};
lblDescription = new Label {
Text = "Omschrijving: "+opdracht.Omschrijving,
TextColor = Color.Black
};
lblAddress = new Label{
Text = "Adres: " + formattedAddress,
TextColor = Color.Black
};
phoneLayout = new StackLayout {
Orientation = StackOrientation.Horizontal
};
lblPhone = new Label {
Text = "Telefoon: ",
TextColor = Color.Black
};
lblPhoneNumber = new Label {
Text = contactpersoon.TelefoonWerk,
TextColor = Color.Blue
};
var tapGestureRecognizer = new TapGestureRecognizer();
tapGestureRecognizer.Tapped += (s, e) => {
var dialer = DependencyService.Get<IDialer> ();
if (dialer != null && contactpersoon.TelefoonWerk != null || contactpersoon.TelefoonWerk!= "") {
dialer.Dial (contactpersoon.TelefoonWerk);
}
};
lblPhoneNumber.GestureRecognizers.Add(tapGestureRecognizer);
phoneLayout.Children.Add (lblPhone);
phoneLayout.Children.Add (lblPhoneNumber);
generalTermsLayout.Children.Add (lblGeneralTerms);
generalTermsLayout.Children.Add (new BoxView{
Color = Color.FromHex ("ddd"),
HeightRequest=1,
VerticalOptions = LayoutOptions.Fill
});
generalTermsLayout.Children.Add (lblCustommerName);
generalTermsLayout.Children.Add (lblDescription);
generalTermsLayout.Children.Add (lblAddress);
generalTermsLayout.Children.Add (phoneLayout);
generalTermsLayout.Children.Add (new BoxView{
Color = Color.FromHex ("ddd"),
HeightRequest=1,
VerticalOptions = LayoutOptions.Fill
});
achievementLayout = new StackLayout ();
lblAchievement = new Label{
Text = "Prestatie",
TextColor = Color.Black,
FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label)),
FontAttributes = FontAttributes.Bold
//.........这里部分代码省略.........