internal DownloadStringCompletedEventArgs(System.Net.DownloadStringCompletedEventArgs e)
 {
     Result    = e.Result;
     UserState = e.UserState;
     Error     = e.Error;
     Cancelled = e.Cancelled;
 }
Esempio n. 2
0
        void AuthHelper_OnDownloadRequestCompleted(object sender, System.Net.DownloadStringCompletedEventArgs e)
        {
            try
            {
                string result = e.Result;
                FBUser user   = JsonConvert.DeserializeObject <FBUser>(result);

                User userAccout = new User()
                {
                    id_user = Int32.Parse(user.id), name = user.name
                };

                App.CurrentUser = userAccout;

                SettingHelper.SetKeyValue <User>("User", userAccout);

                if (OnLoginCompleted != null)
                {
                    OnLoginCompleted(this, e);
                }
            }
            catch (Exception ex)
            {
                if (OnRegisterError != null)
                {
                    OnRegisterError(this, e);
                }
            }
        }
Esempio n. 3
0
 internal UploadStringCompletedEventArgs(System.Net.DownloadStringCompletedEventArgs e) //it is normal that the parameter is of type DownloadStringCompletedEventArgs instead of UploadStringCompletedEventArgs.
 {
     Result    = e.Result;
     UserState = e.UserState;
     Error     = e.Error;
     Cancelled = e.Cancelled;
 }
Esempio n. 4
0
        static void wc_DownloadStringCompleted(object sender, System.Net.DownloadStringCompletedEventArgs e)
        {
            string          res = string.Empty;
            BarListDownload bld = (BarListDownload)e.UserState;

            if (!bld.isValid)
            {
                return;
            }
            if (e.Cancelled || (e.Error != null))
            {
                if (bld.AppendAMEXonFail)
                {
                    DayFromGoogleAsync(bld.Symbol + AMEX, bld.DoResults, false);
                    return;
                }
                bld.DoResults(new BarListImpl(BarInterval.Day, bld.Symbol));
                return;
            }
            res = e.Result;
            BarListImpl bl = new BarListImpl(BarInterval.Day, bld.Symbol);

            string[] line = res.Split(Environment.NewLine.ToCharArray());
            for (int i = line.Length - 1; i > 0; i--)
            {
                if (line[i] != "")
                {
                    addbar(bl, BarImpl.FromCSV(line[i]), 0);
                }
            }
            bld.DoResults(bl);
        }
Esempio n. 5
0
        void ObjectDetailViewModel_OnDownloadRequestCompleted(object sender, System.Net.DownloadStringCompletedEventArgs e)
        {
            IsBusy = false;
            try
            {
                if (e.Error == null)
                {
                    //if (e.UserState == "spaceObject")
                    //{
                    spaceObject.channels = JsonConvert.DeserializeObject <ObservableCollection <SpaceChannel> >(e.Result);
                    //    LoadStream();
                    //}
                    //else if (e.UserState == "stream")
                    //{
                    //    listStream = JsonConvert.DeserializeObject<ObservableCollection<ObjectStream>>(e.Result);
                    //}

                    IsError = false;
                    Message = String.Empty;
                }
                else
                {
                    IsError = true;
                    Message = "We've failed to load your request";
                }
            }
            catch (Exception ex)
            {
                IsError = true;
                Message = "We've failed to load your request";
            }
        }
Esempio n. 6
0
        private void Cli_DownloadStringCompleted(object sender, System.Net.DownloadStringCompletedEventArgs e)
        {
            if (e.Error == null && e.Result != "")
            {
                JavaScriptSerializer s = new JavaScriptSerializer();
                RootObject           r = s.Deserialize <RootObject>(e.Result);

                if (r.total_pages > 1)
                {
                    b_next.IsEnabled = true;
                    if (id_page == r.total_pages)
                    {
                        b_next.IsEnabled = false;
                    }
                    if (id_page > 1)
                    {
                        b_prev.IsEnabled = true;
                    }
                    else
                    {
                        b_prev.IsEnabled = false;
                    }
                }
                dgMain.ItemsSource = r.data;
                t_status.Content   = "Success. Page " + id_page.ToString();
            }
            else
            {
                t_status.Content = "Error. Unable to download page " + id_page.ToString();
            }
        }
Esempio n. 7
0
 public static void OnDownloadStringCompleted(object sender, System.Net.DownloadStringCompletedEventArgs e)
 {
     if (e.Error == null && !string.IsNullOrEmpty(e.Result))
     {
         // do something with e.Result string.
         // _results.Add(e.Result);
     }
 }
Esempio n. 8
0
 void m_client_DownloadStringCompleted(object sender, System.Net.DownloadStringCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         var result = Newtonsoft.Json.JsonConvert.DeserializeObject <WebFontsResult>(e.Result);
         m_webFonts = new List <string>(result.items.Select(i => i.family));
         m_webFonts.Insert(0, string.Empty);
     }
 }
        private void SearchCompletedHandler(System.Net.DownloadStringCompletedEventArgs e)
        {
            SearchGroupTabs = null;
            //TODO examine e.Error
            if (e.Error == null)
            {
                var groupTabs = _tabSearcher.Entries.Where(FilterTab).
                                Select(entry => new TabEntity
                {
                    SearchId  = entry.Id,
                    SearchUrl = entry.Url,
                    Name      = entry.Name,
                    Group     = entry.Artist,
                    Rating    = entry.Rating,
                    Type      = entry.Type,
                    ImageUrl  = Database.GetTabTypeByName(entry.Type).ImageUrl,
                    Votes     = entry.Votes,
                    Version   = entry.Version
                });



                if (_sortOrder == ResultsSortOrder.Popularity)
                {
                    var artistName = CurrentSearchText.TransLiterate();
                    var grouped    = groupTabs.Where(t => t.Group.TransLiterate() == artistName).OrderByDescending(t => t.Votes);
                    IsNothingPopularFound = !grouped.Any();
                    SearchPopularTabs     = new ObservableCollection <TabEntity>(grouped.Take(100));
                    Deployment.Current.Dispatcher.BeginInvoke(() => { IsSearching = false; });
                    //Clear the Search Area (for the Search Page)
                    this.ClearSearchArea();
                }
                else
                {
                    IsNothingFound  = !groupTabs.Any();
                    Pages           = Enumerable.Range(1, _tabSearcher.Summary.PageCount).Select(p => p.ToString());
                    SearchGroupTabs = new TabsByName(new ObservableCollection <TabEntity>(groupTabs), Database);
                    Deployment.Current.Dispatcher.BeginInvoke(
                        () =>
                    {
                        if (Pages.Any())
                        {
                            SelectedPage = Pages.ElementAt(CurrentPageIndex - 1);
                        }
                        RaisePropertyChanged("SelectedPage");
                        AssignHeaderPagingUI(_tabSearcher.Summary.PageCount);
                        IsSearching = false;
                    });
                }
            }
            else
            {
                IsSearching = false;
                ClearSearchArea();
                Dialog.Show(AppResources.Search_Sorry, AppResources.Search_ServerUnavailable);
            }
        }
        void groupImagesSearch_MediaSearchCompleted(object sender, System.Net.DownloadStringCompletedEventArgs e)
        {
            var result = sender as IMediaSearcher;

            if (!string.IsNullOrEmpty(result.Entry.BandName))
            {
                DataService.UpdateGroupMediaByName(result.Entry.BandName, result.Entry.ImageUrl, result.Entry.LargeImageUrl, result.Entry.ExtraLargeImageUrl);
            }
        }
Esempio n. 11
0
        private static void VersionDownloaded(System.Net.DownloadStringCompletedEventArgs result, Form parent, bool verbose, bool mainProgram)
        {
            Exception ex = result.Error;

            System.Version newVersion = null;
            if (ex == null)
            {
                String versionString = result.Result + ".0";
                try
                {
                    newVersion = new Version(versionString);
                }
                catch (Exception e)
                {
                    ex = e;
                }
            }
            if (ex != null)
            {
                MessageBox.Show(parent, String.Format(StringResources.DownloadError, result.Error.Message), StringResources.Ares, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            Version currentVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

            if (currentVersion < newVersion && (!verbose || !result.Cancelled))
            {
                NewVersionDialog dialog = new NewVersionDialog();
                DialogResult     res    = dialog.ShowDialog(parent);
                if (res == DialogResult.Cancel)
                {
                    return;
                }
                if (dialog.ShowChangeLog)
                {
                    String url = GetUrlBase() + StringResources.ChangeLogFile;
                    FileDownloader <String> downloader = new FileDownloader <String>(parent, result.Result, true);
                    if (mainProgram)
                    {
                        downloader.Download(url, StringResources.GettingChangeLog, ChangeLogDownloadedMain);
                    }
                    else
                    {
                        downloader.Download(url, StringResources.GettingChangeLog, ChangeLogDownloadedPlugin);
                    }
                }
                else
                {
                    DownloadSetup(parent, result.Result, mainProgram);
                }
            }
            else if (verbose && !result.Cancelled)
            {
                MessageBox.Show(parent, StringResources.NoNewVersion, StringResources.Ares, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 12
0
        private static void DownloadStringCompleted(object sender, System.Net.DownloadStringCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                Utility.ErrorReporter.SendErrorReport(e.Error, "アップデート情報の取得に失敗しました。");
                return;
            }

            if (e.Result.StartsWith("<!DOCTYPE html>"))
            {
                Utility.Logger.Add(3, "アップデート情報の URI が無効です。");
                return;
            }


            try
            {
                using (var sr = new System.IO.StringReader(e.Result))
                {
                    DateTime date        = DateTimeHelper.CSVStringToTime(sr.ReadLine());
                    string   version     = sr.ReadLine();
                    string   description = sr.ReadToEnd();

                    if (UpdateTime < date)
                    {
                        Utility.Logger.Add(3, "新しいバージョンがリリースされています! : " + version);

                        var result = System.Windows.Forms.MessageBox.Show(
                            string.Format("新しいバージョンがリリースされています! : {0}\r\n更新内容 : \r\n{1}\r\nダウンロードページを開きますか?\r\n(キャンセルすると以降表示しません)",
                                          version, description),
                            "アップデート情報", System.Windows.Forms.MessageBoxButtons.YesNoCancel, System.Windows.Forms.MessageBoxIcon.Information,
                            System.Windows.Forms.MessageBoxDefaultButton.Button1);


                        if (result == System.Windows.Forms.DialogResult.Yes)
                        {
                            System.Diagnostics.Process.Start("http://electronicobserver.blog.fc2.com/");
                        }
                        else if (result == System.Windows.Forms.DialogResult.Cancel)
                        {
                            Utility.Configuration.Config.Life.CheckUpdateInformation = false;
                        }
                    }
                    else
                    {
                        Utility.Logger.Add(1, "お使いのバージョンは最新です。");
                    }
                }
            }
            catch (Exception ex)
            {
                Utility.ErrorReporter.SendErrorReport(ex, "アップデート情報の処理に失敗しました。");
            }
        }
Esempio n. 13
0
        private static void DownloadStringCompleted(object sender, System.Net.DownloadStringCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                Utility.ErrorReporter.SendErrorReport(e.Error, "取得版本信息失败。");
                return;
            }

            if (e.Result.StartsWith("<!DOCTYPE html>"))
            {
                Utility.Logger.Add(3, "アップデート情報の URI が無効です。");
                return;
            }


            try
            {
                using (var sr = new System.IO.StringReader(e.Result))
                {
                    DateTime date        = DateTimeHelper.CSVStringToTime(sr.ReadLine());
                    string   version     = sr.ReadLine();
                    string   description = sr.ReadToEnd();

                    if (UpdateTime < date)
                    {
                        Utility.Logger.Add(3, "", "发现新版本! : " + version);

                        var result = System.Windows.Forms.MessageBox.Show(
                            string.Format("更新版本 : {0}\r\n\r\n更新内容 :\r\n{1}\r\n要打开下载页吗?\r\n( 选择「取消」将不再自动检查更新 )",
                                          version, description),
                            "更新信息", System.Windows.Forms.MessageBoxButtons.YesNoCancel, System.Windows.Forms.MessageBoxIcon.Information,
                            System.Windows.Forms.MessageBoxDefaultButton.Button1);


                        if (result == System.Windows.Forms.DialogResult.Yes)
                        {
                            System.Diagnostics.Process.Start("https://ci.appveyor.com/project/RadarNyan/electronicobserver-icfh9/build/artifacts");
                        }
                        else if (result == System.Windows.Forms.DialogResult.Cancel)
                        {
                            Utility.Configuration.Config.Life.CheckUpdateInformation = false;
                        }
                    }
                    else
                    {
                        Utility.Logger.Add(1, "", "检查更新 : 已经是最新版。");
                    }
                }
            }
            catch (Exception ex)
            {
                Utility.ErrorReporter.SendErrorReport(ex, "处理更新情报失败。");
            }
        }
        private static void DownloadStringCompleted(object sender, System.Net.DownloadStringCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                Utility.ErrorReporter.SendErrorReport(e.Error, "Failed to obtain update data.");
                return;
            }

            if (e.Result.StartsWith("<!DOCTYPE html>"))
            {
                Utility.Logger.Add(3, "Invalid update URL.");
                return;
            }


            try
            {
                var      json        = DynamicJson.Parse(e.Result);
                DateTime date        = DateTimeHelper.CSVStringToTime(json.bld_date);
                string   version     = json.ver;
                string   description = json.note.Replace("<br>", "\r\n");

                if (UpdateTime < date)
                {
                    Utility.Logger.Add(3, Resources.NewVersionFound + version);
                    Task.Run(() => SoftwareUpdater.UpdateSoftware());

                    var result = System.Windows.Forms.MessageBox.Show(
                        string.Format(Resources.AskForUpdate,
                                      version, description),
                        Resources.Update, System.Windows.Forms.MessageBoxButtons.YesNoCancel, System.Windows.Forms.MessageBoxIcon.Information,
                        System.Windows.Forms.MessageBoxDefaultButton.Button1);


                    if (result == System.Windows.Forms.DialogResult.Yes)
                    {
                        System.Diagnostics.Process.Start("https://github.com/silfumus/ElectronicObserver/releases/latest");
                    }
                    else if (result == System.Windows.Forms.DialogResult.Cancel)
                    {
                        Utility.Configuration.Config.Life.CheckUpdateInformation = false;
                    }
                }
                else
                {
                    Utility.Logger.Add(1, "You are currently using the latest version (" + date.ToString("yyyy/MM/dd") + " release).");
                }
            }
            catch (Exception ex)
            {
                Utility.ErrorReporter.SendErrorReport(ex, Resources.UpdateConnectionFailed);
            }
        }
        private static void DownloadStringCompleted(object sender, System.Net.DownloadStringCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                Utility.ErrorReporter.SendErrorReport(e.Error, "アップデート情報の取得に失敗しました。");
                return;
            }

            if (e.Result.StartsWith("<!DOCTYPE html>"))
            {
                Utility.Logger.Add(3, "アップデート情報の URI が無効です。");
                return;
            }


            try
            {
                var updateInfo = Codeplex.Data.DynamicJson.Parse(e.Result);
                {
                    string version     = updateInfo.build.version;
                    string description = updateInfo.build.message;

                    if (version != BuildVersion)
                    {
                        Utility.Logger.Add(3, "新しいバージョンがリリースされています! : " + version);

                        var result = System.Windows.Forms.MessageBox.Show(
                            string.Format("新しいバージョンがリリースされています! : {0}\r\n更新内容 : \r\n{1}\r\nダウンロードページを開きますか?\r\n(キャンセルすると以降表示しません)",
                                          version, description),
                            "アップデート情報", System.Windows.Forms.MessageBoxButtons.YesNoCancel, System.Windows.Forms.MessageBoxIcon.Information,
                            System.Windows.Forms.MessageBoxDefaultButton.Button1);


                        if (result == System.Windows.Forms.DialogResult.Yes)
                        {
                            System.Diagnostics.Process.Start("https://ci.appveyor.com/project/CNA-Bld/electronicobserverextended/build/artifacts");
                        }
                        else if (result == System.Windows.Forms.DialogResult.Cancel)
                        {
                            Utility.Configuration.Config.Life.CheckUpdateInformation = false;
                        }
                    }
                    else
                    {
                        Utility.Logger.Add(1, "お使いのバージョンは最新です。");
                    }
                }
            }
            catch (Exception ex)
            {
                Utility.ErrorReporter.SendErrorReport(ex, "アップデート情報の処理に失敗しました。");
            }
        }
Esempio n. 16
0
 private static void wc_DownloadStringCompleted(object sender, System.Net.DownloadStringCompletedEventArgs e)
 {
     try
     {
         App.FileIO.WatchModel.MakeList(e.Result.ToSafeValue());
     }
     // ReSharper disable EmptyGeneralCatchClause
     catch
     // ReSharper restore EmptyGeneralCatchClause
     {
     }
 }
Esempio n. 17
0
        static void wc_DownloadStringCompleted(System.Net.DownloadStringCompletedEventArgs e, UnturnedPlayer _caller, Service _service, ServiceDefinition _apidefinition, bool _giveItemDirectly)
        {
            VoteResult v = new VoteResult()
            {
                caller = _caller, result = e.Result, apidefinition = _apidefinition, service = _service, giveItemDirectly = _giveItemDirectly
            };

            lock (queue)
            {
                queue.Enqueue(v);
            }
        }
        void groupImagesSearch_MediaSearchCompleted(object sender, System.Net.DownloadStringCompletedEventArgs e)
        {
            var result = sender as IMediaSearcher;

            CurrentTab.Group.ImageUrl           = result.Entry.ImageUrl;
            CurrentTab.Group.LargeImageUrl      = result.Entry.LargeImageUrl;
            CurrentTab.Group.ExtraLargeImageUrl = result.Entry.ExtraLargeImageUrl;

            Database.UpdateGroupMediaByName(CurrentTab.Group.Name, result.Entry.ImageUrl,
                                            result.Entry.LargeImageUrl, result.Entry.ExtraLargeImageUrl);
            //Request A new background imaage
            Hub.RaiseBackGroundImageChangeActivity(CurrentTab.Group.ExtraLargeImageUrl);
        }
        static StackObject *get_Result_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Net.DownloadStringCompletedEventArgs instance_of_this_method = (System.Net.DownloadStringCompletedEventArgs) typeof(System.Net.DownloadStringCompletedEventArgs).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0);
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.Result;

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Esempio n. 20
0
        void GotResults(object sender, System.Net.DownloadStringCompletedEventArgs e)
        {
            BreweryDBHelper.OnRequestCompleted -= GotResults;
            Beers.Clear();
            BreweryDBResult result = JsonConvert.DeserializeObject <BreweryDBResult>(e.Result);

            for (var i = 0; i < result.data.Count(); i++)
            {
                Beers.Add(result.data[i]);
            }


            RequestCompleted(result);
        }
        private static void DownloadStringCompleted(object sender, System.Net.DownloadStringCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                Utility.ErrorReporter.SendErrorReport(e.Error, Resources.UpdateCheckFailed);
                return;
            }

            if (e.Result.StartsWith("<!DOCTYPE html>"))
            {
                Utility.Logger.Add(3, Resources.BadUpdateURI);
                return;
            }


            try {
                using (var sr = new System.IO.StringReader(e.Result)) {
                    DateTime date        = DateTimeHelper.CSVStringToTime(sr.ReadLine());
                    string   version     = sr.ReadLine();
                    string   description = sr.ReadToEnd();

                    if (UpdateTime < date)
                    {
                        Utility.Logger.Add(3, Resources.NewVersionFound + version);

                        var result = System.Windows.Forms.MessageBox.Show(
                            string.Format(Resources.AskForUpdate,
                                          version, description),
                            Resources.Update, System.Windows.Forms.MessageBoxButtons.YesNoCancel, System.Windows.Forms.MessageBoxIcon.Information,
                            System.Windows.Forms.MessageBoxDefaultButton.Button1);


                        if (result == System.Windows.Forms.DialogResult.Yes)
                        {
                            System.Diagnostics.Process.Start("http://tumblr.rkitsune.com/elecobs");
                        }
                        else if (result == System.Windows.Forms.DialogResult.Cancel)
                        {
                            Utility.Configuration.Config.Life.CheckUpdateInformation = false;
                        }
                    }
                    else
                    {
                        Utility.Logger.Add(1, Resources.VersionCurrent);
                    }
                }
            } catch (Exception ex) {
                Utility.ErrorReporter.SendErrorReport(ex, Resources.UpdateConnectionFailed);
            }
        }
Esempio n. 22
0
 private static void wc_mod_DownloadStringCompleted(object sender, System.Net.DownloadStringCompletedEventArgs e)
 {
     try
     {
         if (e.Result == @"KCPlayer.WatchTV.Modify.OK")
         {
             RefreshListItem();
         }
     }
     // ReSharper disable EmptyGeneralCatchClause
     catch
     // ReSharper restore EmptyGeneralCatchClause
     {
     }
 }
Esempio n. 23
0
 void webClient_DownloadStringCompleted(object sender, System.Net.DownloadStringCompletedEventArgs e)
 {
     if (mMonitor != null)
     {
         mMonitor.Close(new Action(() => { mCompletedFct(e, mParent, mParam); }));
     }
     else if (mParent.IsInvokeRequired())
     {
         mParent.Invoke(new Action(() => { mCompletedFct(e, mParent, mParam); }));
     }
     else
     {
         mCompletedFct(e, mParent, mParam);
     }
 }
Esempio n. 24
0
 void DisplayStreamService_OnDownloadRequestCompleted(object sender, System.Net.DownloadStringCompletedEventArgs e)
 {
     try
     {
         if (e.Error == null)
         {
             StreamDataRootObject data = JsonConvert.DeserializeObject <StreamDataRootObject>(e.Result);
             Insert(data.stream);
         }
         else
         {
         }
     }
     catch (Exception ex) {
     }
 }
Esempio n. 25
0
        private static void ChangeLogDownloaded(System.Net.DownloadStringCompletedEventArgs result, Form parent, String version, bool mainProgram)
        {
            if (result.Cancelled)
            {
                return;
            }
            String text = result.Error != null?String.Format(StringResources.ChangeLogError, result.Error.Message) : result.Result;

            ChangeLogDialog dialog = new ChangeLogDialog(text);
            DialogResult    res    = dialog.ShowDialog(parent);

            if (res == DialogResult.OK)
            {
                DownloadSetup(parent, version, mainProgram);
            }
        }
Esempio n. 26
0
        private void OnDownloadStringCompleted(System.Net.DownloadStringCompletedEventArgs e, UnturnedPlayer caller, Service service, ServiceDefinition apidefinition, bool giveItemDirectly)
        {
            VoteResult v = new VoteResult
            {
                Caller           = caller,
                Result           = e.Result,
                ApiDefinition    = apidefinition,
                Service          = service,
                GiveItemDirectly = giveItemDirectly
            };

            lock (_queue)
            {
                _queue.Enqueue(v);
            }
        }
 private void WebClient_DownloadStringCompleted(object sender, System.Net.DownloadStringCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         try
         {
             System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(Crawlers.Sitesmaps.urlset));
             using (System.IO.StringReader reader = new System.IO.StringReader(e.Result))
             {
                 Crawlers.Sitesmaps.urlset sitemap = serializer.Deserialize(reader) as Crawlers.Sitesmaps.urlset;
                 if (sitemap != null)
                 {
                     foreach (var singleItem in sitemap.url)
                     {
                         int locPos = -1;
                         for (int iPos = 0; iPos < singleItem.ItemsElementName.Length; iPos++)
                         {
                             if (singleItem.ItemsElementName[iPos] == ItemsChoiceType.loc)
                             {
                                 locPos = iPos;
                                 break;
                             }
                         }
                         if (locPos > 0)
                         {
                             var locUrl = Convert.ToString(singleItem.Items[locPos]);
                         }
                     }
                 }
             }
         }
         catch (Exception ex)
         {
         }
     }
     else
     {
     }
 }
Esempio n. 28
0
        void wc_DownloadStringCompleted(object sender, System.Net.DownloadStringCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                return;
            }

            try
            {
                if (e.Result.StartsWith("MD_VER:") && e.Result.Trim().Substring(7) != GoogleAnalytics.AppVersion)
                {
                    Invoke(() =>
                    {
                        HomeLink.Content    = "http://megadesktop.com/ - New Version Available!";
                        HomeLink.Foreground = System.Windows.Media.Brushes.Red;
                    });
                }
            }
            catch (Exception)
            {
            }
        }
Esempio n. 29
0
        void qe_DownloadComplete(object sender, System.Net.DownloadStringCompletedEventArgs e)
        {
            QueryEngine qe = (QueryEngine)sender;

            if (e.Error != null)
            {
                Status = "Download failed. " + e.Error.Message;
                //queryList.Remove(qe);
                toolStripProgressBar1.Style = ProgressBarStyle.Blocks;
                return;
            }
            if (e.Cancelled)
            {
                Status = "Download cancelled.";
                //queryList.Remove(qe);
                toolStripProgressBar1.Style = ProgressBarStyle.Blocks;
                return;
            }
            ListViewGroup group = new ListViewGroup(qe.Site + qe.Query);

            lvResults.Groups.Add(group);


            Status = "Download complete. Parsing results from " + new Uri(qe.Site).Host + "... " + (queryList.Count > 1 ? queryList.Count - 1 + " queries queued." : "");

            toolStripProgressBar1.Style = ProgressBarStyle.Marquee;

            foreach (string link in QueryEngine.GetLinks(e.Result))
            {
                ListViewItem item = new ListViewItem(link.Trim().Replace("href=\"/", "href=\"" + qe.Site.Substring(0, qe.Site.ToString().LastIndexOf('/')) + "/"), group);
                lvResults.Items.Add(item);
            }

            queryList.Remove(qe);
            toolStripProgressBar1.Style = ProgressBarStyle.Blocks;

            Status = "Done. " + (lvResults.Items.Count > 0 ? lvResults.Items.Count + " links found." : "");
        }
Esempio n. 30
0
        void HomeViewModel_OnDownloadRequestCompleted(object sender, System.Net.DownloadStringCompletedEventArgs e)
        {
            IsBusy = false;
            try
            {
                if (e.Error == null)
                {
                    NearestSpaceObject = JsonConvert.DeserializeObject <SpaceObject>(e.Result);

                    IsError = false;
                    Message = String.Empty;
                }
                else
                {
                    IsError = true;
                    Message = "We've failed to load your request";
                }
            }
            catch (Exception ex)
            {
                IsError = true;
                Message = "We've failed to load your request";
            }
        }