Click Image which then directs to a url in IE - c#

Windows Phone 8 App
In my MainPage.xaml I have the following:
<Image HorizontalAlignment="Left" Height="215" VerticalAlignment="Top" Width="450" Margin="10,299,-40,0" Source="/Assets/Images/MTCOB.jpg"/>
What I want is for the user to tap this and then a website open in IE8.
In my MainPage.xmal.cs I have the following:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using GamesWithGold.Resources;
using Microsoft.Phone.Tasks;
using System.Windows.Interop;
namespace GamesWithGold
{
public partial class MainPage : PhoneApplicationPage
{
public MainPage()
{
InitializeComponent();
}
private void Image_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
}
}
}
.............
I am new to this so would really like some help getting my first app out in BETA.

Try this:
private void Image_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
WebBrowserTask BrowserTask = new WebBrowserTask();
BrowserTask.Uri = new Uri("http://www.google.com",UriKind.Absolute);
BrowserTask.Show();
}

Related

C# Trying to find the RobloxPlayerBeta

Here is my code: I am trying to find the roblox PlayerBeta but its not working
I am not the best in coding but I found out how to find it but cant implent it right into the code
( EDIT ) The program works if I use the PID but that changes everytime I open up a new RobloxPlayerBeta ! so I cannot use that
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Memory;
using System.Diagnostics;
namespace ForceField
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Mem MemLib = new Mem();
private void button1_Click(object sender, EventArgs e)
{
if (System.Diagnostics.Process.GetProcesses().Any((p) => p.ProcessName.Contains("RobloxPlayerBeta")))
{
int robloxPid = System.Diagnostics.Process.GetProcessesByName("RobloxPlayerBeta").FirstOrDefault().Id;
}
Console.WriteLine(robloxPid);
MemLib.writeMemory("0x184C3A98", "string", "PlsNoBan ");
Console.WriteLine(MemLib.readString("0x184C3A98"));
}
}
}
Omg I am stupid.. xD
I needed to do MemLib.OpenGameProcess(robloxPid)

Why are my checkboxes unchecking when changing Page? WPF C# .NET

So basically.. I added 2 new pages in a frame and when I press a button it changes frame..
But if I check a checkbox on the first page it wont be checked if I go to another page and then go back to the first one..
here is a more visual look http://recordit.co/Py3zptKLck
Source code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace CheckboxesAndPages
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void button_Click(object sender, RoutedEventArgs e)
{
main.Content = new SecondPage();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
main.Content = new thirdPage();
}
}
}
There is no source code for the 2 pages.
You are giving it a new SecondPage every time
SecondPage secondPage = new SecondPage();
private void button_Click(object sender, RoutedEventArgs e)
{
main.Content = secondPage;
}

Connecting VLC Plugin

I want to make stream application for RTSP cam to open VLC
when I press the button show to me the stream in the application but it doesn't show to me anything I want the program to display the stream in VLC
this the code of the application using c#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace vlc
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void axVLCPlugin21_Enter(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
axVLCPlugin21.playlist.add("rtsp://192.168.0.209:554/mpeg4", "live", "network-caching=75");
//pictureBox1.Visible = false;
axVLCPlugin21.playlist.play();
}
}
}

Windows phone back button closes app instead of going back a page

Working on a basic Windows Universal app and currently have the issue where upon pressing back on the details page of my lists it doesn't take me back to the main page but instead closes the app entirely.
MainPage.xaml.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.Phone.UI;
using Windows.UI.Xaml.Navigation;
namespace MoreUniversalAppWork
{
public sealed partial class MainPage : Page
{
public QuoteReader qr = new QuoteReader();
public MainPage()
{
this.InitializeComponent();
this.NavigationCacheMode = NavigationCacheMode.Required;
qr.DownloadQuotes();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
}
private void Hardware_Back(object sender, Windows.Phone.UI.Input.BackPressedEventArgs e)
{
if (Frame.Content is ViewQuote)
{
Frame.Navigate(typeof(MainPage));
e.Handled = true;
}
}
private void LoadQuotes(object sender, RoutedEventArgs e)
{
FillList();
}
private void FillList()
{
// Downloads the JSON file with the quotes and filles List //
qr.DownloadQuotes();
var quotes = qr.quotes_dictionary();
list_quotes.Items.Clear();
foreach (var q in quotes)
{
list_quotes.Items.Add(q.Value);
}
if (list_quotes.Items.Count > 0)
{
list_quotes.ScrollIntoView(list_quotes.Items[0]);
}
}
private void ViewQuote(object sender, SelectionChangedEventArgs e)
{
// Upon clicking quote in list, details page is opened //
Frame.Navigate(typeof(ViewQuote), list_quotes.SelectedValue);
}
}
}
ViewQuote.xaml.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.ComponentModel;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Phone.UI.Input;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkID=390556
namespace MoreUniversalAppWork
{
public sealed partial class ViewQuote : Page
{
string quote;
public ViewQuote()
{
this.InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
quote = e.Parameter as string;
quote_display.Text = quote;
}
}
}
This is normal in Windows Phone 8.1. You may want to have a workaround in App.xaml.cs file.
public App()
{
this.InitializeComponent();
HardwareButtons.BackPressed += HardwareButtons_BackPressed;
}
void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e)
{
Frame rootFrame = Window.Current.Content as Frame;
if (rootFrame != null && rootFrame.CanGoBack)
{
e.Handled = true;
rootFrame.GoBack();
}
}
WP8.1 back button quits the app

The call between InitializeComponent(); is ambiguous?

My error is:
Error 4 The call is ambiguous between the following methods or properties: 'Grub2._0.Time.InitializeComponent()' and
'Grub2._0.Time.InitializeComponent()'
Here is my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
namespace Grub2._0
{
public partial class Time2 : PhoneApplicationPage
{
public void Time2.()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
if (AMRadioButton.IsChecked == true)
NavigationService.Navigate(new Uri("/PolicemanFood.xaml", UriKind.Relative));
else if (PMRadioButton.IsChecked == false)
NavigationService.Navigate(new Uri("/Weed.xaml", UriKind.Relative));
else
NavigationService.Navigate(new Uri("/BurgerKing.xaml", UriKind.Relative));
}
}
}
I met this proplem when I put 2 wpf projects in one solution which shares some libs, and then open the 2 at the same time. Seems the 2 visual studio instance want generate code for the 2 exe at the same time, which causes conflicts.
Closing one of them solves the problem.
Try this code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
namespace Grub2._0
{
public partial class Time2 : PhoneApplicationPage
{
public Time2()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
if (AMRadioButton.IsChecked == true)
NavigationService.Navigate(new Uri("/PolicemanFood.xaml", UriKind.Relative));
else if (PMRadioButton.IsChecked == false)
NavigationService.Navigate(new Uri("/Weed.xaml", UriKind.Relative));
else
NavigationService.Navigate(new Uri("/BurgerKing.xaml", UriKind.Relative));
}
}
}
Removed the void keyword and period after Time2 on the constructor.

Categories

Resources