Call MarkerClick Method - xamarin

I wonder how I could able to call MMap_MarkerClick from MMap_InfoWindowClick?
private void MMap_InfoWindowClick(object sender, GoogleMap.InfoWindowClickEventArgs e)
{
//call MMap_MarkerClick
}
private void MMap_MarkerClick(object sender, GoogleMap.MarkerClickEventArgs e)
{
ViewModel.MapMarkerSelected(e.Marker.Title);
}
I am trying to achive it, because MMap_InfoWindowClick does not open new ViewModel, but MMap_MarkerClick does. MarkerClick works but InfoWindowClick does not open ViewModel

Related

Creating a Notepad- Windows forms

New in the business. Iam creating a windows form Notepad. How do I do the Button Open to open a file and a specific compatible file?
KInd off. I am creating a Notepad with Visual Studio. In the Menu strip, I created a buttion save and another open. De form design its ok, now I need to lear the code c#, to put in the event "Open file" in the notepad that I am creating.
public MeuBloco()
{
InitializeComponent();
}
private void guardarToolStripMenuItem_Click(object sender, EventArgs e)
{
saveFileDialog1.ShowDialog();
}
private void SalvarOK(object sender, CancelEventArgs e)
{
string caminho = saveFileDialog1.FileName;
File.WriteAllText(caminho, txbJanela.Text);
}
private void abrirToolStripMenuItem_Click(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
}
private void OpenOk(object sender, CancelEventArgs e)
{
}
}
}
// Now I need to code the event to open the file I want.

C# MySql - data does not appear after insert new data

First of all, I'm new to C# and also programming. So, my situation is after I insert data from a textbox to MySql database, the new data does not appear. FYI, I have the navigation (next previous) button. I have to re-run the apps in order for the new data to be displayed. Here's part of the codes:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
//MySql codes to display in textbox
showData(pos);
}
public void showData(int index)
{
txtDisplay.Text = table.Rows[index][0].ToString();
}
private void btnPrevious_Click(object sender, EventArgs e)
{
}
private void btnNext_Click(object sender, EventArgs e)
{
}
private void btnGenNext_Click(object sender, EventArgs e)
{
//codes to generate new data and also insert into db
}
}
Here's my full codes:

Calling button click from another button click

How to press RoutedEventArgs e button (button in page) from EventArgs e button (button on application bar) in windows phone 7
private void button3_Click(object sender, EventArgs e)
{
button0_Click(sender, e);
}
private void button0_Click(object sender, RoutedEventArgs e)
{
}
when i am using above code its giving me
cannot convert from 'System.EventArgs' to 'System.Windows.RoutedEventArgs'
Please Help
SMS CODE:
SmsComposeTask SCT = new SmsComposeTask();
PhoneApplicationService PAS = PhoneApplicationService.Current;
public string SMSNO;
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
object sample;
if (PAS.State.TryGetValue("numbertext", out sample))
SMSNO = sample as string;
if (PAS.State.TryGetValue("messagetext", out sample))
txtOutput.Text = sample as string;
base.OnNavigatedTo(e);
}
private void button2_Click(object sender, RoutedEventArgs e)
{
if (txtOutput.Text != "")
{
SCT.To = SMSNO;
SCT.Body = txtOutput.Text;
SCT.Show();
}
else
{
MessageBox.Show("Output is Empty to send SMS.", "Wait!", MessageBoxButton.OK);
}
}
protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
{
PAS.State["numbertext"] = SMSNO;
PAS.State["messagetext"] = txtOutput.Text;
base.OnNavigatedFrom(e);
}
If you don't use the parameter inside button0_Click, you can just call button0_Click(sender, null); (the reason is that the event from the application bar don't bubble that's why they don't have a RoutedEventArg parameter)

photo chooser task windows phone 7.1

i need to take a picture from the directory of Windows phone in my application so i add a child Windows when i click on the text in this child Windows i add a button and i called
public partial class AnnotationControl : ChildWindow
{
public ObservableCollection<string> cercle { get; set; }
public AnnotationControl()
{
InitializeComponent();
}
private void ChildWindow_Closing_1(object sender, System.ComponentModel.CancelEventArgs e)
{
}
private void btnsave_Click_1(object sender, RoutedEventArgs e)
{
this.DialogResult = true;
}
private void btnCancel_Click_1(object sender, RoutedEventArgs e)
{
this.DialogResult = true;
}
private void browse_Click(object sender, RoutedEventArgs e)
{
PhotoChooserTask objPhotoChooser = new PhotoChooserTask();
objPhotoChooser.Completed += new EventHandler<PhotoResult>(PhotoChooseCall);
objPhotoChooser.Show();
}
but when i clicked on the button to choose a picture the application crashed
"Application_UnhandledException"
some one have any idea please
Use this may be helpful
private void changeImage(object sender, RoutedEventArgs e)
{
PhotoChooserTask photoChooserTask = new PhotoChooserTask();
photoChooserTask.Completed += new EventHandler<PhotoResult>(photoChooserTask_Completed);
photoChooserTask.Show();
}
void photoChooserTask_Completed(object sender, PhotoResult e)
{
if (e.TaskResult == TaskResult.OK)
{
System.Windows.Media.Imaging.BitmapImage bmp = new System.Windows.Media.Imaging.BitmapImage();
bmp.SetSource(e.ChosenPhoto);
imageTapped.Source = bmp;
}
}

event PageIndexChanging wasn't handled

I'm getting "The GridView 'grdFiles' fired event PageIndexChanging which wasn't handled." even if I've added the event handler:
protected void grdFiles_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GetFiles();
grdFiles.PageIndex = e.NewPageIndex;
grdFiles.DataBind();
}
Any ideas?
Try this code. You need to declare a method on your code behind that handles the PageIndexChanging event.
protected void grdFiles_PageIndexChanging (object sender, GridViewPageEventArgs e)
{
grdFiles.PageIndex = e.NewPageIndex;
bindGridView()
}
the method bindGridView() is
private void bindGridView()
{
grdFiles.DataSource=.....;
grdFiles.DataBind();
}

Resources