void FooterForwardClicked(object sender, EventArgs args) { if (MyWeb.CanGoForward) { MyWeb.GoForward(); } }
private static void InstallApplication(HttpContext context) { String strApp = context.Request["app"]; if (strApp == null) { context.Response.Write("No app name"); } else { if (MyWeb.GetApplication(strApp) != null) { context.Response.Write("App already exists"); } else { MyWebManifest manifest = MyWeb.GetManifest(strApp); if (manifest == null) { context.Response.Write("Manifest not found"); } else { if (manifest.Install() != null) { context.Response.Write("Installed successfully"); } else { context.Response.Write("Couldnt install"); } } } } }
/// <include file='doc\myweb2.uex' path='docs/doc[@for="myweb2Page.Launch_Application"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void Launch_Application(Object sender, EventArgs e) { MyWebApplication app = MyWeb.GetApplication(appurl); String LaunchURL = (app.Manifest.Url.Length > 0)?(add_ProtSchem(appurl) + add_RelUrl(appurl, app.Manifest.Url)): "myweb://" + (appurl + "/default.aspx"); Response.Redirect(LaunchURL); }
private static void ShowAdminPage(HttpContext context) { HttpResponse Response = context.Response; context.Response.Write("<H1>Manage MyWeb Applications</H1>"); MyWebApplication [] apps = MyWeb.GetInstalledApplications(); if (apps == null || apps.Length < 1) { context.Response.Write("No apps"); } else { context.Response.Write("There are " + apps.Length + " installed apps"); } if (apps != null) { for (int iter = 0; iter < apps.Length; iter++) { Response.Write("<p>--------------------------------------------------<p>"); Response.Write("<b>Name: </b>" + apps[iter].Manifest.Name + "<br>"); Response.Write("<b>Location: </b>" + apps[iter].Manifest.InstalledLocation + "<br>"); Response.Write("<b>Url: </b>" + apps[iter].Manifest.Url + "<br>"); Response.Write("<b>IconUrl: </b>" + apps[iter].Manifest.IconUrl + "<br>"); Response.Write("<b>HelpUrl: </b>" + apps[iter].Manifest.HelpUrl + "<br>"); Response.Write("<b>DiskSize: </b>" + apps[iter].Manifest.Size + "<br>"); Response.Write("<b>Author: </b>" + apps[iter].Manifest.Author + "<br>"); Response.Write("<b>Source: </b>" + apps[iter].Manifest.Source + "<br>"); Response.Write("<b>Title: </b>" + apps[iter].Manifest.Title + "<br>"); Response.Write("<b>ManifestFile: </b>" + apps[iter].Manifest.ManifestFile + "<br>"); Response.Write("<b>Version: </b>" + apps[iter].Manifest.Version + "<br>"); Response.Write("<b>CabFile: </b>" + apps[iter].Manifest.CabFile + "<br>"); Response.Write("<b>License: </b>" + apps[iter].Manifest.License + "<br>"); Response.Write("<b>ApplicationUrl: </b>" + apps[iter].Manifest.ApplicationUrl + "<br>"); Response.Write("<b>RemoteIconUrl: </b>" + apps[iter].Manifest.RemoteIconUrl + "<br>"); Response.Write("<b>RemoteHelpUrl: </b>" + apps[iter].Manifest.RemoteHelpUrl + "<br>"); Response.Write("<a href=myweb://Home/myweb.axd?Action=remove&app=" + apps[iter].Manifest.ApplicationUrl + "><b>Remove this app</b></a> , "); Response.Write("<a href=myweb://Home/myweb.axd?Action=Move&app=" + apps[iter].Manifest.ApplicationUrl + "><b> Move this app</b></a>"); Response.Write("<a href=myweb://Home/myweb.axd?Action=update&app=" + apps[iter].Manifest.ApplicationUrl + "><b> Check for updates</b></a>"); } } Response.Write("<p>----------------------------------<p>"); Response.Write("Install an app:"); Response.Write("<form method=POST action=\"myweb://Home/myweb.axd\" >" + "<input type=hidden name=\"Action\" value=\"install\" />" + "<input type=text name=\"app\"/>" + "<input type=submit name=\"Submit\" value=\"Submit\"/>"); }
private static void UpdateApplication(HttpContext context) { String strApp = context.Request["app"]; if (strApp == null) { context.Response.Write("No app name"); return; } MyWebApplication app = MyWeb.GetApplication(strApp); if (app == null) { context.Response.Write("App not found"); return; } MyWebManifest manifest = MyWeb.GetManifest(strApp); if (manifest == null) { context.Response.Write("manifest not found"); return; } String strC = context.Request["confirmed"]; if (strC == null || strC.Equals("y") == false) { context.Response.Write("Current installed version: " + app.Manifest.Version); context.Response.Write("<p>Version on server: " + manifest.Version); if (!manifest.Version.Equals(app.Manifest.Version)) { context.Response.Write("<a href=\"myweb://Home/myweb.axd?Action=update&app=" + strApp + "&confirmed=y\"/> Update now (recommended) </a>"); } else { context.Response.Write("<a href=\"myweb://Home/myweb.axd?Action=update&app=" + strApp + "&confirmed=y\"/> Update now (not-recommended) </a>"); } } else { app.Remove(); if (manifest.Install() != null) { context.Response.Write("Successfully updated"); } else { context.Response.Write("couldnt update: app has been removed"); } } }
void FooterBackClicked(object sender, EventArgs args) { if (MyWeb.CanGoBack) { MyWeb.GoBack(); } else { MyWeb.Source = App.webURL; } }
/// <include file='doc\myweb1.uex' path='docs/doc[@for="myweb1Page.Launch_Application"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void Launch_Application(Object sender, EventArgs e) { MyWebApplication app = MyWeb.GetApplication(appurl); if (app == null) { Response.Redirect("myweb://Home/myweb1.aspx?success=notfound"); } else { String LaunchURL = (app.Manifest.Url.Length > 0)?(add_ProtSchem(appurl) + add_RelUrl(appurl, app.Manifest.Url)):(add_ProtSchem(appurl) + "/default.aspx"); Response.Redirect(LaunchURL); } }
private async void MainInternet_Click_1(object sender, RoutedEventArgs e) { Debug.WriteLine("Thread Number is Now Before Downloading is ..." + Thread.CurrentThread.ManagedThreadId); string MyHtml = "Denis"; await Task.Run(async() => { Debug.WriteLine("Thread Number is Now While Downloading is ..." + Thread.CurrentThread.ManagedThreadId); HttpClient WebClient = new HttpClient(); string Httml = WebClient.GetStringAsync("Https://google.Com").Result; MyHtml = Httml; }); Debug.WriteLine("Thread Number is Now After Downloading is ..." + Thread.CurrentThread.ManagedThreadId); MainInternet.Content = "Done Downloading"; MyWeb.SetValue(HtmlProperity, MyHtml); }
/// <include file='doc\update.uex' path='docs/doc[@for="updatePage.Submit_Click"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void Submit_Click(Object sender, EventArgs e) { MyWebApplication app = MyWeb.GetApplication(UrlHidden.Value); String installedLocation = app.Manifest.InstalledLocation; String name = app.Manifest.Name; if (app != null) { int update = app.Update(); Response.Redirect("myweb://Home/myweb2.aspx?name=" + name + "&success=" + update.ToString() + "&URL=" + UrlHidden.Value + "&installedLocation=" + installedLocation); } else if (app == null) { Response.Redirect("myweb://Home/myweb2.aspx?name=" + name + "&success=NoApp"); } }
/// <include file='doc\remove.uex' path='docs/doc[@for="removePage.Page_Load"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void Page_Load(Object sender, EventArgs e) { if (!IsPostBack) { String appurl = Request.QueryString["url"]; MyWebApplication app = MyWeb.GetApplication(appurl); if (app == null) { remove = false; } if (app != null && appurl != null && appurl.Length > 0) { UrlHidden.Value = appurl; AppName.Text = (app.Manifest.Name.Length > 0) ? (app.Manifest.Name):"myweb://" + (app.Manifest.ApplicationUrl); remove = true; } } }
/// <include file='doc\install.uex' path='docs/doc[@for="installPage.Install"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void Install(Object sender, EventArgs e) { MyWebManifest manifest = MyWeb.GetManifest(HiddenUrl.Value); if (manifest == null) { Response.Redirect("myweb://Home/myweb1.aspx?success=no"); } else { if (manifest.Install() == null) { Response.Redirect("myweb://Home/myweb1.aspx?success=no"); } else { Response.Redirect("myweb://Home/myweb1.aspx?success=yes&URL=" + HiddenUrl.Value); } } }
/// <include file='doc\remove.uex' path='docs/doc[@for="removePage.Submit_Click"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void Submit_Click(Object sender, EventArgs e) { MyWebApplication app = MyWeb.GetApplication(UrlHidden.Value); String installedLocation = app.Manifest.InstalledLocation; String name = app.Manifest.Name; if ((name == null) && (name.Length == 0)) { name = app.Manifest.ApplicationUrl; } if (app != null) { int remove = app.Remove(); Response.Redirect("myweb://Home/myweb3.aspx?remove=" + remove.ToString() + "&installedLocation=" + installedLocation + "&name=" + name); } }
/// <include file='doc\default.uex' path='docs/doc[@for="defaultPage.Page_Load"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void Page_Load(Object sender, EventArgs e) { MyWebApplication [] apps = MyWeb.GetInstalledApplications(); if (apps == null) { return; } ApplicationList.DataSource = new ArrayList(apps); Page.DataBind(); for (int i = 0; i < ApplicationList.Items.Count; i++) { Repeater r = (Repeater)ApplicationList.Items[i].FindControl("InnerRepeater"); r.DataSource = (String [])apps[i].Manifest.CustomUrlDescriptions; r.DataBind(); } }
/// <include file='doc\update.uex' path='docs/doc[@for="updatePage.Page_Load"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void Page_Load(Object sender, EventArgs e) { if (!IsPostBack) { String appurl = Request.QueryString["url"]; MyWebApplication app = MyWeb.GetApplication(appurl); //checking if local if (app.LocalApplication) { Response.Redirect("myweb://Home/myweb2.aspx?success=local"); } else if (app != null && appurl != null && appurl.Length > 0) { UrlHidden.Value = appurl; AppName.Text = (app.Manifest.Name.Length > 0) ? (app.Manifest.Name):"the Local Application selected";; String oldVersion = app.Manifest.Version; oldVersion = oldVersion.ToLower(CultureInfo.InvariantCulture); MyWebManifest newManifest = MyWeb.GetManifest(appurl); if (newManifest == null) { Response.Redirect("myweb://Home/myweb2.aspx?success=notfound"); } else { String newVersion = newManifest.Version; newVersion = newVersion.ToLower(CultureInfo.InvariantCulture); if (!oldVersion.Equals(newVersion)) { update = true; NewVersion.Text = newVersion; OldVersion.Text = oldVersion; } } } } }
private static void MoveApplication(HttpContext context) { String strApp = context.Request["app"]; if (strApp == null) { context.Response.Write("No app name"); return; } String strLoc = context.Request["newlocation"]; if (strLoc == null) { context.Response.Write("New location for app " + strApp + ": "); context.Response.Write("<form method=POST action=\"myweb://Home/myweb.axd\" >" + "<input type=hidden name=\"Action\" value=\"Move\" />" + "<input type=hidden name=\"app\" value=\"" + strApp + "\" />" + "<input type=text name=\"newlocation\" />" + "<input type=submit name=\"Move\" value=\"Move\"/>"); return; } MyWebApplication app = MyWeb.GetApplication(strApp); if (app == null) { context.Response.Write("App not found"); } else { if (app.Move(strLoc) == 0) { context.Response.Write("Moved app"); } else { context.Response.Write("Not able to move app"); } } }
private static void RemoveApplication(HttpContext context) { String strApp = context.Request["app"]; if (strApp == null) { context.Response.Write("No app name"); } else { MyWebApplication app = MyWeb.GetApplication(strApp); if (app == null) { context.Response.Write("App not found"); } else { app.Remove(); context.Response.Write("Removed app"); } } }
/// <include file='doc\install.uex' path='docs/doc[@for="installPage.InstallLocalApp"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void InstallLocalApp(Object sender, EventArgs e) { String localPath = HiddenUrl.Value; //manifest = MyWeb.GetManifestForLocalApplication(localPath); String localURL; localURL = UrlText.Text; if (localURL.Length > 0 && localURL != null) { if (!(FindSpecialChar(localURL) == "a")) { Response.Redirect("myweb://Home/install.aspx?NoURL=3&LocalPath=" + localPath + "&SpecChar=" + FindSpecialChar(localURL) + "&localURL=" + localURL); } else { localURL = localURL.Replace(' ', '_'); localURL = localURL.Replace('\\', '/'); app = MyWeb.GetApplication(localURL); if (app != null) { Response.Redirect("myweb://Home/install.aspx?NoURL=2&LocalPath=" + localPath); } MyWeb.InstallLocalApplication(localURL, localPath); Response.Redirect("myweb://Home/myweb1.aspx?success=yes&URL=" + localURL + "&Local=true"); } } else { Response.Redirect("myweb://Home/install.aspx?NoURL=1&LocalPath=" + localPath); } }
/// <include file='doc\install.uex' path='docs/doc[@for="installPage.Page_Load"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void Page_Load(Object sender, EventArgs e) { if (!IsPostBack) { String NoURL = Request["NoURL"]; if (NoURL == "1") { HiddenUrl.Value = Request["LocalPath"]; addlocal = true; manifest = MyWeb.GetManifestForLocalApplication(HiddenUrl.Value); localInstall.Text = "<center><p>A local application is being installed. A URL must be entered for each local application.<br> Enter the URL for this application below: </p></center>"; } else if (NoURL == "2") { HiddenUrl.Value = Request["LocalPath"]; addlocal = true; manifest = MyWeb.GetManifestForLocalApplication(HiddenUrl.Value); localInstall.Text = "<center><p>The URL entered already exists. Please enter a different URL.</p></center>"; } else if (NoURL == "3") { String SpecChar = Request["SpecChar"]; HiddenUrl.Value = Request["LocalPath"]; addlocal = true; manifest = MyWeb.GetManifestForLocalApplication(HiddenUrl.Value); localInstall.Text = "<center><p>The URL entered contains the following special character:<b>'" + SpecChar + "'</b><br> Please omit this character from the URL.</p></center>"; UrlText.Text = Request["localURL"]; } else { bool fShowInstall = true; int iAction = 0; String appurl = Request["installurl"]; if (appurl == null) { appurl = Request["MyWebPage"]; } if (appurl != null && appurl.Length > 0) { app = MyWeb.GetApplication(appurl); if (app != null) { iAction = 1; fShowInstall = true; } else { if (appurl.StartsWith("\\\\") && (appurl.LastIndexOf('\\') < 2)) { addlocal = true; } else if ((appurl[1] == ':') && (appurl.Length == 2)) { fShowInstall = true; iAction = 4; } else if (appurl[1] == ':' && appurl[2] != '/') { if (Directory.Exists(appurl)) { addlocal = true; } else { if (File.Exists(appurl)) { addlocal = true; int slash = appurl.LastIndexOf('\\'); appurl = appurl.Substring(0, slash); } else { //directory is not valid fShowInstall = true; iAction = 4; } } } if (addlocal) { manifest = MyWeb.GetManifestForLocalApplication(appurl); //checking if the manifest exists if (manifest.Url != null && manifest.Url.Length > 0) { if (!(FindSpecialChar(manifest.Url) == "a")) { Response.Redirect("myweb://Home/myweb1.aspx?success=specialChar&SpecChar=" + FindSpecialChar(manifest.Url) + "&Path=" + appurl); } else { HiddenUrl.Value = appurl; fShowInstall = false; String temp = appurl.Replace('\\', '/'); UrlText.Text = "localhost/" + temp.Substring(3); localInstall.Text = "<center><p>A local path has been detected. A URL must be entered for each local application.<br> Below is the suggested URL. You may choose to edit it or leave it unmodified.</p></center>"; } } else { if (File.Exists(appurl + "\\default.aspx")) { HiddenUrl.Value = appurl; fShowInstall = false; String temp = appurl.Replace('\\', '/'); UrlText.Text = "localhost/" + temp.Substring(3); localInstall.Text = "<center><p>A local path has been detected. A URL must be entered for each local application.<br> Below is the suggested URL. You may choose to edit it or leave it unmodified.</p></center>"; } else { fShowInstall = true; iAction = 3; } } if (!fShowInstall) { //if the app exists, checking that local application has not been already installed MyWebApplication [] apps = MyWeb.GetInstalledApplications(); if (apps != null) { for (int i = 0; i < apps.Length; i++) { if (apps[i].LocalApplication) { String Oldtemp = apps[i].Manifest.InstalledLocation.ToLower(CultureInfo.InvariantCulture); String Newtemp = appurl.ToLower(CultureInfo.InvariantCulture); if (Oldtemp.EndsWith("\\") && !Newtemp.EndsWith("\\")) { Newtemp = Newtemp + "\\"; } else if (Newtemp.EndsWith("\\") && !Oldtemp.EndsWith("\\")) { Oldtemp = Oldtemp + "\\"; } if (Oldtemp.Equals(Newtemp)) { iAction = 1; fShowInstall = true; } } } } } } if ((!addlocal) && (iAction != 3) && (iAction != 4)) { manifest = MyWeb.GetManifest(appurl); if (manifest != null) { if (!(FindSpecialChar(manifest.Url) == "a")) { Response.Redirect("myweb://Home/myweb1.aspx?success=specialChar&SpecChar=" + FindSpecialChar(manifest.Url) + "&Path=" + appurl); } else { HiddenUrl.Value = appurl; fShowInstall = false; // populate the details } } else { iAction = 2; } } } } if (fShowInstall) { String strRedirect = "myweb://Home/addlocal.aspx?Reason=" + iAction; if (appurl != null && appurl.Length > 0) { strRedirect += "&installurl=" + appurl; } Response.Redirect(strRedirect); return; } if (manifest.Url != null && manifest.Url.Length > 0) { DataBind(); } } } }
/// <include file='doc\sync.uex' path='docs/doc[@for="syncPage.Page_Load"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void Page_Load(Object sender, EventArgs e) { if (!IsPostBack) { MyWebApplication [] apps = MyWeb.GetInstalledApplications(); ArrayList appsNotFound = new ArrayList(); if (apps == null) { SyncLabel.Text = "There are no applications to be updated."; update = false; } else { DataTable dt = new DataTable(); DataRow dr; dt.Columns.Add(new DataColumn("Application", typeof(string))); dt.Columns.Add(new DataColumn("InstalledVersion", typeof(string))); dt.Columns.Add(new DataColumn("NewVersion", typeof(string))); for (int i = 0; i < apps.Length; i++) { if (!apps[i].LocalApplication) { String oldVersion = apps[i].Manifest.Version; oldVersion = oldVersion.ToLower(CultureInfo.InvariantCulture); MyWebManifest newManifest = MyWeb.GetManifest(apps[i].Manifest.ApplicationUrl); if (newManifest == null) { appsNotFound.Add(apps[i].Manifest.Name); } else { String newVersion = newManifest.Version; if (newManifest.Version.Length <= 0 && newManifest.Version == null) { appsNotFound.Add(apps[i].Manifest.Name); } else { newVersion = newVersion.ToLower(CultureInfo.InvariantCulture); if (!oldVersion.Equals(newVersion)) { dr = dt.NewRow(); dr[0] = apps[i].Manifest.Name; dr[1] = apps[i].Manifest.Version; dr[2] = newManifest.Version; dt.Rows.Add(dr); appsForUpdate.Add(apps[i]); } } } } } if (appsForUpdate.Count <= 0) { SyncLabel.Text = "None of the installed applications are eligible for update."; update = false; } else { UpdateDataList.DataSource = new DataView(dt); UpdateDataList.DataBind(); update = true; SyncLabel.Text = "The following applications are eligible for update. Deselect the applications you do not wish to update."; Application["appsForUpdate"] = appsForUpdate; } } } }