Windows 8 metro - errors while navigating between pages in C# - c#

on a MainPage, I have a button which could take me to another page.
private void button_clicked(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
if (this.Frame != null)
{
this.Frame.Navigate(typeof(AnotherPage));
}
}
However, it gives me this error:
Error 1 'test.CreateAccountPage' does not contain a definition for 'button_createAccount_clicked' and no extension method 'button_createAccount_clicked' accepting a first argument of type 'test.CreateAccountPage' could be found (are you missing a using directive or an assembly reference?) C:\Users\Anggrian\Documents\Visual Studio 2012\Projects\test\test\CreateAccountPage.xaml 55 98
I swear to God it worked yesterday, now I am clueless

Try going to line 55 in C:\Users\Anggrian\Documents\Visual Studio 2012\Projects\test\test\CreateAccountPage.xaml and replace button_createAccount_clicked with button_clicked

Related

In C#, I am getting an error when requesting permission for speech recognition Xamarin Android

So I am using the Plugin.SpeechRecognition Nuget Package and following the exact code on line and its not working.
I have tried adding the "Plugin.Permissions" Nuget Package and that hasn't helped and i have tried googling the problem but there isn't anyone getting this issue and it seems to work fine for everyone. I have also tried removing the "await" keyword and it just says
Operator '==' cannot be applied to operands of type 'IObservable' and 'bool'
Here is my code:
private async void GetSpeechPermission()
{
var granted = await CrossSpeechRecognition.Current.RequestPermission();
if (granted == true)
{
// go!
}
}
so what should happen is there is no error what so ever and the code should run fine but the line of code
await CrossSpeechRecognition.Current.RequestPermission();
has a red underline saying
IObservable' does not contain a definition for 'GetAwaiter' and no extension method 'GetAwaiter' accepting a first argument of type 'IObservable' could be found (are you missing a using directive or an assembly reference?)
when I am using the EXACT code provided by the creator of the plugin from here https://github.com/aritchie/speechrecognition
Any help is MUCH appreciated!!
The Solution to this was to add
using System.Reactive.Linq
in the using section of the code and instead of using a bool value as the code example for the plugin suggests, instead, in the if statement, convert the "granted" variable to a string and then check for "Available", Code:
private async void GetSpeechPermission()
{
var granted = await CrossSpeechRecognition.Current.RequestPermission();
if (granted.ToString() == "Available")
{
//GO
}
}
Hope this helps some one! :D

MVVMCross update error: does not contain a definition for 'EndingWith' and no extension method 'EndingWith'

I am working on Windows Universal App using Visual Studio 2013.
I've just upgraded MVVMCross in my solution via nuget and in the App.cs, the following method used to work without problem
public class App : MvxApplication
{
public override void Initialize()
{
CreatableTypes()
.EndingWith("Service")
.AsInterfaces()
.RegisterAsLazySingleton();
RegisterAppStart<ViewModels.StartViewModel>();
}
}
However after the upgrade I get the following error
Error 2 'System.Collections.Generic.IEnumerable<System.Type>' does not contain a definition for 'EndingWith' and no extension method 'EndingWith' accepting a first argument of type 'System.Collections.Generic.IEnumerable<System.Type>' could be found (are you missing a using directive or an assembly reference?) D:\Users\Vicky\OneDrive\Dev\WUA\KpopQuiz.Core\KpopQuiz.Core\App.cs 11 18 KpopQuiz.Core
Is the EndingWith depreciated or is there a new way of Initialing the Service classes?
You just need to add a reference with using MvvmCross.Platform.IoC; to use it.

C# WPF Application Printing issue (PageOrientation property not existing)

Has anyone ran into problem where you just can't use the PageOrientation property in your C# WPF project? I have tried everything, put it still says:
"The name 'PageOrientation' does not exist in the current context".
I have all usings included, just can't figure it out.
Here's my printing method:
private void btnPrindi_Click(object sender, RoutedEventArgs e)
{
PrintDialog prtDlg = new PrintDialog();
if (prtDlg.ShowDialog() == true)
{
**prtDlg.PrintTicket.PageOrientation = PageOrientation.Landscape;**
Size pageSize = new Size(prtDlg.PrintableAreaWidth - 30, prtDlg.PrintableAreaHeight - 30);
gridKaart.Measure(pageSize);
gridKaart.Arrange(new Rect(15,15,pageSize.Width,pageSize.Height));
prtDlg.PrintVisual(gridKaart,"Patsiendikaart");
}
}
The error actually refers to the enumeration (PageOrientation.Landscape) on the right hand side of your assignment.
If the property did not exist you would receive (try compiling "".Y and you'll see what I mean):
'string' does not contain a definition for 'Y' and no extension method 'Y' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)
Compare this to Aoeui.Dhtns:
The name 'Aoeui' does not exist in the current context
You are likely missing a namespace reference required, like System.Printing:
// ...
using System.Printing;
// ...
The other possibility is you have not referenced ReachFramework.
If you have, your code compiles as-is:

The type or namespace name 'Class1' could not be found (are you missing a using directive or an assembly reference?)

Using VS2012 , asp/c#
Created New Website empty project
created new asp file
created new c# class file, dialog comes up saying I need to have this class in App_Code folder, I said yes ok.
Website
Default.aspx
Default.aspx.cs
App_Code
Class1.cs
My default.aspx.cs file calls (creates instance) Class1.cs. Below error happens when I put this website in remote server. my localhost server website is coming up.
Compiler Error Message: CS0246: The type or namespace name 'Class1' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 11: protected void Page_Load(object sender, EventArgs e)
Line 12: {
Line 13: Class1 cls = new Class1();
Line 14: cls.getValue();
Line 15: }
Try
Class1.Class1 cls = new Class1.Class1();
Instead of
Class1 cls = new Class1();

Windows.Navigation.NavigationMode Windows Phone 7

I have been following this tutorial about "How to: Preserve and Restore Page State for Windows Phone" found at http://goo.gl/ct7ui and one of the lines of code is this:
protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
{
// If this is a back navigation, the page will be discarded, so there
// is no need to save state.
if (e.NavigationMode != System.Windows.Navigation.NavigationMode.Back)
{
// Save the ViewModel variable in the page's State dictionary.
State["ViewModel"] = _viewModel;
}
}
However visual studio does not seem to like this bit of code giving me the error below:
'System.Windows.Navigation.NavigationEventArgs' does not contain a definition for 'NavigationMode' and no extension method 'NavigationMode' accepting a first argument of type 'System.Windows.Navigation.NavigationEventArgs' could be found (are you missing a using directive or an assembly reference?)
Any ideas on what i've messed up with here. Now considering 'e' is System.Windows.Navigation.NavigationEventArgs and the bit after the if statement shows System.Windows.Navigation.NavigationMode.Back, i don't for the life of me see how this is giving an error
NavigationMode is an enum in System.Windows.Navigation. Try adding
using System.Windows.Navigation;

Categories

Resources