public void DownloadSubtitle(bool autoPlay = false, int pos = 0) { DownloadTempSubtitles(activeSubtitles[currentActiveSubtitle]); _tempThred = new Java.Lang.Thread(() => { try { bool _done = false; for (int i = 0; i < 1000; i++) { if (!_done) { Java.Lang.Thread.Sleep(10); if (SubtitleDoneDownloading()) { _done = true; if (autoPlay) { DoLink(0, pos, useSub: true); } } } } } finally { _tempThred.Join(); //invoke(onCompleted); } }); _tempThred.Start(); }
private void Fun_GetGoldPrice() { string resultStringDr1 = null; Java.Lang.Thread th = new Java.Lang.Thread(); th = new Java.Lang.Thread(() => { try { resultStringDr1 = WCFDataRequest.Instance.SvrRequest( "P_GoldPriceInfo", new string[] { }, new string[] { }); } catch { return; } if (resultStringDr1 != "鏈接錯誤" && resultStringDr1 != "鏈接超時") { RunOnUiThread(() => { loading(resultStringDr1); }); } else { RunOnUiThread(() => { MessageBox.Show(this, resultStringDr1, "請檢查網絡或者聯系服務商"); }); } }); th.Start(); }
public override StartCommandResult OnStartCommand(Android.Content.Intent intent, StartCommandFlags flags, int startId) { var t = new Java.Lang.Thread(() => { _cts = new CancellationTokenSource(); Task.Run(() => { try { var counter = new ScreenReceiver(); //counter.ExecutePost(_cts.Token).Wait(); } catch (Android.Accounts.OperationCanceledException) { } finally { if (_cts.IsCancellationRequested) { } } }, _cts.Token); } ); t.Start(); return(StartCommandResult.RedeliverIntent); }
public void ShowActionSheet() { #region ActinSheet Items List<ActionSheetArgs> items = new List<ActionSheetArgs>(); var alipayItem = new ActionSheetArgs("支付宝"); alipayItem.OnClick += () => { if (!AlipayHelper.CheckConfig()) { Toast.MakeText(ApplicationContext, "系统异常.", ToastLength.Long); Log.Error(Tag, "Aplipay Config Exception "); return; } string payInfo = AlipayHelper.GetPayInfo(); // 完整的符合支付宝参数规范的订单信息 Runnable payRunnable = new Runnable(() => { PayTask alipay = new PayTask(this); // 调用支付接口,获取支付结果 string result = alipay.Pay(payInfo); Message msg = new Message { What = (int)MsgWhat.AlipayPayFlag, Obj = result }; _handler.SendMessage(msg); }); // 必须异步调用 Thread payThread = new Thread(payRunnable); payThread.Start(); }; items.Add(alipayItem); var weixinItem = new ActionSheetArgs("微信"); weixinItem.OnClick += () => { Runnable wxpayRunnable = new Runnable(() => { _weixinpayHelper = new WeixinpayHelper(this); _weixinpayHelper.Execute(); }); // 必须异步调用 Thread payThread = new Thread(wxpayRunnable); payThread.Start(); }; items.Add(weixinItem); #endregion var menuView = new ActionSheet(this); menuView.SetCancelButtonTitle("取消");// before add items menuView.Items = items; menuView.CancelableOnTouchOutside = true; menuView.ShowMenu(); }
public override void start() { if (t == null) { t = new Java.Lang.Thread(this); t.Start(); } }
public void Run() { // Show process dialog _progressDialog.Show(); // Start Thread to Run task _thread = new Thread(_task.Run); _thread.Start(); }
private void UpdateThreadName(Request <Bitmap> data) { string name = data.Name; StringBuilder builder = s_NameBuilder.Value; builder.EnsureCapacity(Utils.ThreadPrefix.Length + name.Length); builder.Insert(Utils.ThreadPrefix.Length, name); Thread.CurrentThread().Name = builder.ToString(); }
/** Puts the buffer back into the FIFO without sending the packet. */ public void commitBuffer() { if (mThread == null) { mThread = new Java.Lang.Thread(this); mThread.Start(); } if (++mBufferIn >= mBufferCount) { mBufferIn = 0; } mBufferCommitted.Release(); }
public override void stop() { if (t != null) { try { inputStream.Close(); } catch (IOException ignore) { } t.Interrupt(); try { t.Join(); } catch (InterruptedException e) { } t = null; } }
/** Entry point. */ public static void runTest(ExtractMpegFrames obj) { try { var wrapper = new ExtractMpegFramesWrapper(obj); Java.Lang.Thread th = new Java.Lang.Thread(wrapper, "codec test"); th.Start(); th.Join(); if (wrapper.mThrowable != null) { throw wrapper.mThrowable; } } catch (System.Exception e) { Console.WriteLine(e); throw; } }
/** Sends the RTP packet over the network. */ public void commitBuffer(int length) { updateSequence(); mPackets[mBufferIn].Length = length; mAverageBitrate.push(length); if (++mBufferIn >= mBufferCount) { mBufferIn = 0; } mBufferCommitted.Release(); if (mThread == null) { mThread = new Java.Lang.Thread(this); mThread.Start(); } }
private void Fun_GetGoldPrice() { string resultStringDr1 = null; Java.Lang.Thread th = new Java.Lang.Thread(); th = new Java.Lang.Thread(() => { try { resultStringDr1 = WCFDataRequest.Instance.SvrRequest( "P_GoldPriceInfo", new string[] { }, new string[] { }); } catch { return; } if (resultStringDr1 != "鏈接錯誤" && resultStringDr1 != "鏈接超時") { RunOnUiThread(() => { Intent layOut = new Intent(); //layOut.SetClass(this, typeof(MainActivity)); layOut.SetClass(this, typeof(OtherMainActivity)); Bundle homeData = new Bundle(); homeData.PutString("resultStringDr1", resultStringDr1); layOut.PutExtras(homeData); StartActivity(layOut); this.Finish(); }); } else { RunOnUiThread(() => { MessageBox.Show(this, resultStringDr1, "請檢查網絡或者聯系服務商"); }); } }); th.Start(); }
public void Start() { object lck = new object(); lock (lck) { thread = CreateThread(Name); try { socket = CreateSocket(); socket.SoTimeout = SOCKET_TIMEOUT; } catch (SocketException e) { throw new RtpMidiSessionServerRuntimeException("DatagramSocket cannot be opened", e); } thread.Start(); Log.Debug("RtpMidi", "MIDI session server started"); } }
public void Run() { try { UpdateThreadName(m_Data); Result = Hunt(); if (Result == null) { m_Dispatcher.DispatchFailed(this); } else { m_Dispatcher.DispatchComplete(this); } } catch (ResponseException ex) { Exception = ex; m_Dispatcher.DispatchFailed(this); } catch (IOException ex) { Exception = ex; m_Dispatcher.DispatchRetry(this); } catch (Exception ex) { Exception = ex; m_Dispatcher.DispatchFailed(this); } finally { Thread.CurrentThread().Name = Utils.ThreadIdleName; } }
public void Run() { difTime1 = Common.NanoTime(); EventHandler <OnTactEventArgs> onTactHandler = OnTactEvent; OnTactEventArgs e = new OnTactEventArgs(); int tact = 0; int counter = 1; while (true) { if (isPlaying) { USleep(pulsesPerQuarterNote); PlayCurrentMarkerPositions(); currentSongPosition++; counter++; if (counter > pulsesPerQuarterNote) { tact++; e.CurrentTact = tact % 4; e.CurrentTempo = СurrentTempo; OnTactEvent(this, e); counter = 1; } if (currentSongPosition > Tracks[0].MidiEvents[CurrentMarker.StopIndex].absTime) { GotoSection(GetNextSection(CurrentMarker), false); } } else { Thread.Yield(); } } }
public void SurfaceCreated(ISurfaceHolder holder) { this.IsRunning = true; this.Thread = new Java.Lang.Thread(this); this.Thread.Start(); }
void Run() { Process.SetThreadPriority(ThreadPriority.Background); if (_context._adapter == null) { _context.SendMessage(ConstantsCustomGallery.FETCH_STARTED); } File file; var selectedImages = new List <long>(); if (_context._images != null) { for (int i = 0, l = _context._images.Count; i < l; i++) { var image = _context._images[i]; file = new File(image.Path); if (file.Exists() && image.IsSelected) { selectedImages.Add(image.Id); } } } var cursor = _context.Application.ApplicationContext.ContentResolver.Query( MediaStore.Images.Media.ExternalContentUri, _context._projection, MediaStore.Images.Media.InterfaceConsts.BucketDisplayName + " =?", new string[] { _context._album }, MediaStore.Images.Media.InterfaceConsts.DateAdded); if (cursor == null) { _context.SendMessage(ConstantsCustomGallery.ERROR); return; } /* * In case this runnable is executed to onChange calling loadImages, * using countSelected variable can result in a race condition. To avoid that, * tempCountSelected keeps track of number of selected images. On handling * FETCH_COMPLETED message, countSelected is assigned value of tempCountSelected. */ int tempCountSelected = 0; var temp = new List <Image>(cursor.Count); if (cursor.MoveToLast()) { do { if (Thread.Interrupted()) { return; } var id = cursor.GetLong(cursor.GetColumnIndex(_context._projection[0])); var name = cursor.GetString(cursor.GetColumnIndex(_context._projection[1])); var path = cursor.GetString(cursor.GetColumnIndex(_context._projection[2])); var isSelected = selectedImages.Contains(id); if (isSelected) { tempCountSelected++; } file = null; try { file = new File(path); } catch (Exception e) { Log.Debug("Exception : ", e.ToString()); } if (file.Exists()) { temp.Add(new Image(id, name, path, isSelected)); } } while (cursor.MoveToPrevious()); } cursor.Close(); if (_context._images == null) { _context._images = new List <Image>(); } _context._images.Clear(); _context._images.AddRange(temp); _context.SendMessage(ConstantsCustomGallery.FETCH_COMPLETED, tempCountSelected); }
public void SurfaceCreated(ISurfaceHolder holder) { this.IsRunning = true; this.Thread = new Java.Lang.Thread(this); this.Thread.Start(); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.ax_Search, container, false); // _w.RecyclerView rez = view as _w.RecyclerView; __view = view; ___view = view; ax_search = this; var bar = __view.FindViewById <ProgressBar>(Resource.Id.progressBar1); //bar.Visibility = ViewStates.Gone; pbar = bar; // _w.RecyclerView rez = view as _w.RecyclerView; //inflater.Inflate(Resource.Layout.ax_Search, container, false) as _w.RecyclerView; SearchView search = view.FindViewById <SearchView>(Resource.Id.movie_seach); _w.RecyclerView re = view.FindViewById <_w.RecyclerView>(Resource.Id.recyclerView_movies); _re = re; search.SetQueryHint(new Java.Lang.String("Movie Search")); //search.SetQuery(new Java.Lang.String("HELLO"), true); search.QueryTextSubmit += async(o, e) => { search.ClearFocus(); if (searchDone) { searchDone = false; MainActivity.searchFor = e.Query; // Intent intent = new Intent(search.Context, typeof(SearchResultsActivity)); //StartActivity(intent); Action onCompleted = () => { //print("daaaaaaaaaaaaaaaa") // UpdateList(); ChangeBar(100); searchDone = true; // }; sThred = new Java.Lang.Thread( () => { try { Search(e.Query); //Thread.Sleep(1000); } finally { onCompleted(); sThred.Join(); //invoke(onCompleted); } }); sThred.Start(); ChangeBar(0); } }; re.SetItemClickListener((rv, position, _view) => { SelectMovie(rv, position, _view); }); re.LongClickable = true; /* * re.LongClickable = true; * re.SetOnLongClickListener((rv, position, _view) => * { * //An item has been clicked * HistoryPressTitle(movieTitles[wlink[position]]); * movieSelectedID = wlink[position]; * Context context = _view.Context; * Intent intent = new Intent(context, typeof(SearchResultsActivity)); * // intent.PutExtra(CheeseDetailActivity.EXTRA_NAME, values[position]); * * context.StartActivity(intent); * * }); */ /* * var buttons = view.FindViewById<LinearLayout>(Resource.Id.s_Buttons); * * LinearLayout linearLayout = buttons; //new LinearLayout(this); * linearLayout.Orientation = (Android.Widget.Orientation.Vertical); * * for (int i = 0; i < 100; i++) { * var button = new Button(this.Context); * button.Text = "Button " + i; * button.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); * button.Click += (o, e) => * { * //selectedTitle = button.Text; * //ClosePoster(ViewStates.Visible); * Intent intent = new Intent(search.Context, typeof(SearchResultsActivity)); * StartActivity(intent); * }; * linearLayout.AddView(button); * btts.Add(button); * }*/ // bar.Progress = MainActivity.bar_progress; //IRunnable // search.SetQuery("test", true); // search.SetFocusable(ViewFocusability.Focusable); //search.SetIconifiedByDefault(false); search.OnActionViewExpanded(); search.ClearFocus(); searchView = view.FindViewById <SearchView>(Resource.Id.movie_seach); // imm.HideSoftInputFromInputMethod(search.WindowToken, HideSoftInputFlags.None); //search.RequestFocusFromTouch(); return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.ax_Links, container, false); // _w.RecyclerView rez = view as _w.RecyclerView; // print(view.AccessibilityClassName); // System.Diagnostics.Debug.WriteLine("TTTTTTTTTTTTTTT" + view.); var bar = view.FindViewById <ProgressBar>(Resource.Id.progressBarLinks); ImageButton playListBtt = view.FindViewById <ImageButton>(Resource.Id.playList); playListBtt.Click += (o, e) => { string path = MainActivity.GenerateM3UFileFromLoadedLinks("TempList", flinks: flink, reverse: movieIsAnime[movieSelectedID], placeInLinksFolder: false); if (path != "error") { OpenPathAsVieo(path); } }; if (currentMain && movieProvider[movieSelectedID] == 4) { playListBtt.Visibility = ViewStates.Gone; } bool m3uEnabled = true;// ax_Settings.SettingsGetChecked(10); // bar.layout if (showExtraListButtons) { Button copyM3U = view.FindViewById <Button>(Resource.Id.copym3u); Button generateM3U = view.FindViewById <Button>(Resource.Id.generatem3u); copyM3U.Visibility = ViewStates.Gone; generateM3U.Visibility = ViewStates.Gone; copyM3U.Visibility = m3uEnabled ? ViewStates.Visible : ViewStates.Gone; generateM3U.Visibility = m3uEnabled ? ViewStates.Visible : ViewStates.Gone; copyM3U.Click += (o, e) => { string m3uCopy = MainActivity.GetM3UFileFromLoadedLinks(); ClipboardManager clip = (ClipboardManager)Context.GetSystemService(Context.ClipboardService); clip.PrimaryClip = ClipData.NewPlainText("m3u", m3uCopy); ShowSnackBar("Copied m3u To Clipboard!", ax_links.View); }; generateM3U.Click += (o, e) => { string path = MainActivity.GenerateM3UFileFromLoadedLinks(); Action <View> action = new Action <View>((View v) => { OpenPathAsVieo(path); }); ShowSnackBar("Download m3u to " + path, ax_links.View, "Play list", action); }; } //bar.Visibility = ViewStates.Gone; pbar = bar; if (SearchResultsActivity.veiws == 0) { // pbar.Visibility = ViewStates.Gone; currentMain = true; ax_links = this; } else { ax_links_sub = this; } if (SearchResultsActivity.veiws == 1) { ax_Links_all = new List <ax_Links>(); } ax_Links_all.Add(this); currnView = SearchResultsActivity.veiws; SearchResultsActivity.veiws++; // _w.RecyclerView rez = view as _w.RecyclerView; //inflater.Inflate(Resource.Layout.ax_Search, container, false) as _w.RecyclerView; _w.RecyclerView re = view.FindViewById <_w.RecyclerView>(Resource.Id.recyclerView_links); _re = re; __view = view; // ---------- ON LINK CLICKED ---------- re.SetItemClickListener((rv, position, _view) => { var check = view.FindViewById <CheckBox>(Resource.Id.checkBox1); string linkName = activeLinksNames[flink[position]]; bool overideSettings = (movieProvider[movieSelectedID] == 4 && linkName.StartsWith("Episode") && currentMain); int rAct = 0; if (!check.Checked) { //Toast t = new Toast(Context); print("Loading: " + movieTitles[movieSelectedID] + " | " + activeLinksNames[flink[position]]); rAct = 0; if (!overideSettings) { rAct = ax_Settings.SettingsGetDef(0, true); print("PRIMARY: " + rAct); } if (ax_Settings.SettingsGetChecked(4) && (rAct == 0 || rAct == 5)) { // DoLink(ax_Settings.SettingsGetDef(1), position); DoLink(9, position); } ChangeBar(pbar.Progress); // bool downloadFile = false; // string link = activeLinks[flink[position]]; // if (!downloadFile) { // } // else { // HistoryPressTitle("D___" + movieTitles[movieSelectedID] + "|" + activeLinksNames[flink[position]]); // DoLink(2, position); // } } else { // DoLink(1, position); rAct = 1; if (!overideSettings) { rAct = ax_Settings.SettingsGetDef(1, true); print("SECONDARY: " + rAct); } } DoLink(rAct, position); }); // ---------- LOADED ALL LINKS ---------- Action onCompleted = () => { //print("daaaaaaaaaaaaaaaa") // UpdateList(); // ChangeBar(100); if (movieSelectedID >= movieTitles.Count || movieSelectedID < 0) { } else { ChangeBar(100); if (ax_links_sub != null) { if (movieProvider[movieSelectedID] == 0) { ax_links_sub.ChangeBar(100); } } print(movieProvider[movieSelectedID].ToString()); linksDone = true; } // }; // ---------- LOAD LINKS ---------- if (currentMain) // not request twice { thredNumber++; sThred = new Java.Lang.Thread( () => { try { ChangeBar(0); GetURLFromTitle(movieSelectedID); //Thread.Sleep(1000); } finally { onCompleted(); sThred.Join(); //invoke(onCompleted); } }); sThred.Start(); } UpdateList(); /* * var buttons = view.FindViewById<LinearLayout>(Resource.Id.s_Buttons); * * LinearLayout linearLayout = buttons; //new LinearLayout(this); * linearLayout.Orientation = (Android.Widget.Orientation.Vertical); * * for (int i = 0; i < 100; i++) { * var button = new Button(this.Context); * button.Text = "Button " + i; * button.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); * button.Click += (o, e) => * { * //selectedTitle = button.Text; * //ClosePoster(ViewStates.Visible); * Intent intent = new Intent(search.Context, typeof(SearchResultsActivity)); * StartActivity(intent); * }; * linearLayout.AddView(button); * btts.Add(button); * }*/ // bar.Progress = MainActivity.bar_progress; //IRunnable //Activity.OnBackPressed(); return(view); }
/// <summary> /// id 0 = run VLC, 1 = Only history, 2 = Download, 3 = remove download, 4 = play download, 5 = copy link, 6 = chromecast, 7 = copy browser, 8 = Load links, 9 = Non invert history, 10 = copy subtitle URL, 11 = play vlc with subtitle, 12 = NOT USED /// </summary> /// <param name="id"></param> /// <param name="pos"></param> /// <param name="v"></param> void DoLink(int id, int pos, View v = null, string extra = "", bool useSub = false) { string link = activeLinks[flink[pos]]; string linkName = activeLinksNames[flink[pos]]; if (movieProvider[movieSelectedID] == 4 && linkName.StartsWith("Episode") && currentMain && (id == 0 || id == 8)) // ------------- EPISODE SELECT TV SERIES ------------- { string episode = FindHTML(linkName, "Episode ", ":"); print("Episode id:" + episode); List <string> _activeLinks = new List <string>(); List <string> _activeLinksNames = new List <string>(); activeSubtitles = new List <string>(); activeSubtitlesNames = new List <string>(); for (int i = 0; i < activeLinks.Count; i++) { if (activeLinksNames[i].StartsWith("Episode")) { _activeLinksNames.Add(activeLinksNames[i]); _activeLinks.Add(activeLinks[i]); } } activeLinks = _activeLinks; activeLinksNames = _activeLinksNames; thredNumber++; ShowSnackBar("Loading Links For Episode " + episode, ax_Links.__view); tempThred = new Java.Lang.Thread( () => { try { GetUrlFromMovie123(movieSelectedID, thredNumber, "https://movies123.pro" + link, false, episode); //Thread.Sleep(1000); } finally { tempThred.Join(); //invoke(onCompleted); } }); tempThred.Start(); } else if (id == 0) // ------------- RUN VLC ------------- // Intent intent = new Intent(Intent.ActionView); /* * string absolutePath = Android.OS.Environment.ExternalStorageDirectory + "/" + Android.OS.Environment.DirectoryDownloads; * string basePath = absolutePath + "/Youtube"; * string subPath = "yeet" + ".mp4"; * * string rootPath = basePath + "/" + subPath; */ { Android.Net.Uri uri = Android.Net.Uri.Parse(link); // intent.SetData(uri); // intent.PutExtra("title", movieTitles[movieSelectedID].Replace("B___", "").Replace(" (Bookmark)", "") + " | " + activeLinksNames[flink[pos]]); //intent.PutExtra(EXTRA_FILENAME, movieTitles[movieSelectedID].Replace("B___", "").Replace(" (Bookmark)", "") + " | " + activeLinksNames[flink[pos]]); // intent.PutExtra(EXTRA_RETURN_RESULT, true); // StartActivityForResult(intent, REQUEST_CODE); Intent vlcIntent = new Intent(Intent.ActionView); vlcIntent.SetPackage("org.videolan.vlc"); vlcIntent.PutExtra("title", movieTitles[movieSelectedID].Replace("B___", "").Replace(" (Bookmark)", "") + " | " + activeLinksNames[flink[pos]]); vlcIntent.AddFlags(ActivityFlags.GrantReadUriPermission); vlcIntent.AddFlags(ActivityFlags.GrantWriteUriPermission); vlcIntent.AddFlags(ActivityFlags.GrantPrefixUriPermission); vlcIntent.AddFlags(ActivityFlags.GrantPersistableUriPermission); if (useSub) { try { if (currentActiveSubtitle >= 0) { var localC = Application.Context.GetSharedPreferences("Subtitle", FileCreationMode.Private); DownloadManager manager; manager = (DownloadManager)ax_Links.ax_links.Context.GetSystemService(Context.DownloadService); long subId = localC.GetLong("temp", -1); if (subId == -1) { } else { // for (int i = 0; i < 1000; i++) { // Java.Lang.Thread.Sleep(10); Android.Net.Uri u = manager.GetUriForDownloadedFile(subId); string truePath = "file://" + Android.OS.Environment.ExternalStorageDirectory + "/" + Android.OS.Environment.DirectoryDownloads + "/" + SUBTITLE_PATH; string _truePath = manager.GetUriForDownloadedFile(subId).Path; string __truePath = activeSubtitles[currentActiveSubtitle]; string subtitlePath = truePath;//activeSubtitles[currentActiveSubtitle]; vlcIntent.PutExtra("subtitles_location", subtitlePath); // vlcIntent.PutExtra("item_location", truePath); // intent.PutExtra(EXTRA_SUBTITLE_NAMES, activeSubtitlesNames[currentActiveSubtitle]); print("Loaded subtitles: " + activeSubtitlesNames[currentActiveSubtitle] + "||" + activeSubtitles[currentActiveSubtitle]); print("FROM PATH: " + subtitlePath); } // intent.PutExtra(EXTRA_ENABLED_SUBTITLES, true); } } catch (System.Exception) { } } vlcIntent.SetDataAndType(uri, "video/*"); StartActivityForResult(vlcIntent, 42); } else if (id == 1) // ------------- REVERSE HISTORY (TOGGLE VIEWSTATE) ------------- //HistoryPressTitle(movieTitles[movieSelectedID].Replace("B___", "").Replace(" (Bookmark)", "") + "|" + activeLinksNames[flink[pos]], true); { if (!currentMain && movieProvider[movieSelectedID] == 4) { HistoryPressTitle(movieTitles[movieSelectedID].Replace("B___", "").Replace(" (Bookmark)", "") + "|" + currentEpisodeName + "|" + activeLinksNames[flink[pos]], true); } else { HistoryPressTitle(movieTitles[movieSelectedID].Replace("B___", "").Replace(" (Bookmark)", "") + "|" + activeLinksNames[flink[pos]], true); } UpdateList(); _re.ScrollToPosition(pos); } else if (id == 2) // ------------- DOWNLOAD ------------- // string link = activeLinks[flink[pos]]; { UpdateList(); _re.ScrollToPosition(pos); StartNewDownload(link, (movieTitles[movieSelectedID].Replace("B___", "").Replace(" (Bookmark)", "") + "_" + activeLinksNames[flink[pos]]).ToLower().Replace(" ", "_"), (movieIsAnime[movieSelectedID] ? "Anime" : "Movie")); } else if (id == 3) // ------------- REMOVE DOWNLOAD ------------- { UpdateList(); _re.ScrollToPosition(pos); RemoveDownload(movieTitles[movieSelectedID].Replace("B___", "").Replace(" (Bookmark)", "") + "_" + activeLinksNames[flink[pos]], mainActivity, this.View); } else if (id == 4) // ------------- PLAY DOWNLOADED FILE ------------- { ax_Downloads.PlayDownloadFileFromTitle((movieTitles[movieSelectedID].Replace("B___", "").Replace(" (Bookmark)", "") + "_" + activeLinksNames[flink[pos]]).ToLower().Replace(" ", "_")); } else if (id == 5) // ------------- COPY LINK ------------- //print("Loading: " + movieTitles[movieSelectedID] + " | " + activeLinksNames[flink[pos]]); { ClipboardManager clip = (ClipboardManager)Context.GetSystemService(Context.ClipboardService); clip.PrimaryClip = ClipData.NewPlainText("Link", activeLinks[flink[pos]]); ShowSnackBar("Copied " + activeLinksNames[flink[pos]] + " Link To Clipboard!", ax_links.View); } else if (id == 6) // ------------- CHOMECAST ------------- { castWithSubtitle = -1; CastVideo(link); Intent intent = new Intent(Context, typeof(ChromeCastActivity)); StartActivity(intent); } else if (id == 7) // ------------- COPY BROWSER SITE (TV-SERIES ONLY) ------------- { ClipboardManager clip = (ClipboardManager)Context.GetSystemService(Context.ClipboardService); clip.PrimaryClip = ClipData.NewPlainText("Link", "https://movies123.pro" + activeLinks[flink[pos]]); ShowSnackBar("Copied " + activeLinksNames[flink[pos]] + " Link To Clipboard!", ax_links.View); } else if (id == 9) // ------------- JUST TOGGLE AS VIEWED HISTORY ------------- { if (!currentMain && movieProvider[movieSelectedID] == 4) { HistoryPressTitle(movieTitles[movieSelectedID].Replace("B___", "").Replace(" (Bookmark)", "") + "|" + currentEpisodeName + "|" + activeLinksNames[flink[pos]]); } else { HistoryPressTitle(movieTitles[movieSelectedID].Replace("B___", "").Replace(" (Bookmark)", "") + "|" + activeLinksNames[flink[pos]]); } UpdateList(); _re.ScrollToPosition(pos); } else if (id == 10) // ------------- COPY SUBTITLE URL ------------- { if (SHOW_INFO_SUBTITLES) { ClipboardManager clip = (ClipboardManager)Context.GetSystemService(Context.ClipboardService); clip.PrimaryClip = ClipData.NewPlainText("Link", activeSubtitles[currentActiveSubtitle]); ShowSnackBar("Copied " + activeSubtitlesNames[currentActiveSubtitle] + " Subtitle Link To Clipboard!", ax_links.View); } else { PopupMenu menu = new PopupMenu(ax_links.Context, v); menu.MenuInflater.Inflate(Resource.Menu.menu1, menu.Menu); for (int i = 0; i < activeSubtitles.Count; i++) { menu.Menu.Add(activeSubtitlesNames[i]); } menu.MenuItemClick += (s, arg) => { print("ITEMID:" + arg.Item.ItemId.ToString()); // currentActiveSubtitle = -1; int _pos = -1; for (int i = 0; i < activeSubtitlesNames.Count; i++) { if (activeSubtitlesNames[i] == arg.Item.TitleFormatted.ToString()) { _pos = i; } } if (_pos != -1) { ClipboardManager clip = (ClipboardManager)Context.GetSystemService(Context.ClipboardService); clip.PrimaryClip = ClipData.NewPlainText("Link", activeSubtitles[_pos]); ShowSnackBar("Copied " + activeSubtitlesNames[_pos] + " Subtitle Link To Clipboard!", ax_links.View); } // Toast.MakeText(mainActivity, string.Format("Menu {0} clicked", arg.Item.TitleFormatted), ToastLength.Short).Show(); }; menu.DismissEvent += (s, arg) => { //Toast.MakeText(mainActivity, string.Format("Menu dissmissed"), ToastLength.Short).Show(); }; menu.Show(); } } else if (id == 11) // ------------- PLAY VLC WITH SUBTITLE ------------- //StartNewDownload(activeSubtitles[currentActiveSubtitle], movieTitles[movieSelectedID].Replace("B___", "").Replace(" (Bookmark)", "") + " | " + activeLinksNames[flink[pos]] + " | " + activeSubtitlesNames[currentActiveSubtitle], "Subtitles"); { if (SHOW_INFO_SUBTITLES) { DownloadSubtitle(true, pos); } else { PopupMenu menu = new PopupMenu(ax_links.Context, v); menu.MenuInflater.Inflate(Resource.Menu.menu1, menu.Menu); for (int i = 0; i < activeSubtitles.Count; i++) { menu.Menu.Add(activeSubtitlesNames[i]); } menu.MenuItemClick += (s, arg) => { print("ITEMID:" + arg.Item.ItemId.ToString()); currentActiveSubtitle = -1; for (int i = 0; i < activeSubtitlesNames.Count; i++) { if (activeSubtitlesNames[i] == arg.Item.TitleFormatted.ToString()) { currentActiveSubtitle = i; } } if (currentActiveSubtitle != -1) { DownloadSubtitle(true, pos); } // Toast.MakeText(mainActivity, string.Format("Menu {0} clicked", arg.Item.TitleFormatted), ToastLength.Short).Show(); }; menu.DismissEvent += (s, arg) => { //Toast.MakeText(mainActivity, string.Format("Menu dissmissed"), ToastLength.Short).Show(); }; menu.Show(); } } else if (id == -100) // ------------- NOT USED, WAS USED TO CAST WITH A DOWNLOAD SUBTITLE ------------- { string subtitleURL = movieTitles[movieSelectedID].Replace("B___", "").Replace(" (Bookmark)", "") + " | " + activeLinksNames[flink[pos]] + " | " + activeSubtitlesNames[currentActiveSubtitle]; DoLink(0, pos, null, subtitleURL); } else if (id == 12) // ------------- CHROMECAST WITH SUBTITLES ------------- { PopupMenu menu = new PopupMenu(ax_links.Context, v); menu.MenuInflater.Inflate(Resource.Menu.menu1, menu.Menu); for (int i = 0; i < activeSubtitles.Count; i++) { menu.Menu.Add(activeSubtitlesNames[i]); } menu.MenuItemClick += (s, arg) => { print("ITEMID:" + arg.Item.ItemId.ToString()); currentActiveSubtitle = -1; for (int i = 0; i < activeSubtitlesNames.Count; i++) { if (activeSubtitlesNames[i] == arg.Item.TitleFormatted.ToString()) { currentActiveSubtitle = i; } } if (currentActiveSubtitle != -1) { castWithSubtitle = currentActiveSubtitle; CastVideo(link); Intent intent = new Intent(Context, typeof(ChromeCastActivity)); StartActivity(intent); } // Toast.MakeText(mainActivity, string.Format("Menu {0} clicked", arg.Item.TitleFormatted), ToastLength.Short).Show(); }; menu.DismissEvent += (s, arg) => { //Toast.MakeText(mainActivity, string.Format("Menu dissmissed"), ToastLength.Short).Show(); }; menu.Show(); } }
private void Start() { t = new Java.Lang.Thread(); t.Start(); }
public void UncaughtException(Java.Lang.Thread t, Java.Lang.Throwable e) { @interface?.UncaughtException(t, e); action(t, e); }
public void StartListenForUDP() { UDPBroadcastThread = new Java.Lang.Thread(new Runnable(Run)); UDPBroadcastThread.Start(); }
public void UncaughtException(Java.Lang.Thread thread, Throwable ex) { Mint.XamarinException(ex.ToJavaException(), false, null); LastBreath(); UncaughtExceptionHandled(null, ex); }
/** The Thread sends the packets in the FIFO one by one at a constant rate. */ public void IRunnable.Run() { Statistics stats = new Statistics(50, 3000); try { // Caches mCacheSize milliseconds of the stream in the FIFO. Java.Lang.Thread.Sleep(mCacheSize); long delta = 0; while (mBufferCommitted.TryAcquire(4, TimeUnit.Seconds)) { if (mOldTimestamp != 0) { // We use our knowledge of the clock rate of the stream and the difference between two timestamps to // compute the time lapse that the packet represents. if ((mTimestamps[mBufferOut] - mOldTimestamp) > 0) { stats.push(mTimestamps[mBufferOut] - mOldTimestamp); long d = stats.average() / 1000000; //Log.d(TAG,"delay: "+d+" d: "+(mTimestamps[mBufferOut]-mOldTimestamp)/1000000); // We ensure that packets are sent at a constant and suitable rate no matter how the RtpSocket is used. if (mCacheSize > 0) { Java.Lang.Thread.Sleep(d); } } else if ((mTimestamps[mBufferOut] - mOldTimestamp) < 0) { Log.Error(TAG, "TS: " + mTimestamps[mBufferOut] + " OLD: " + mOldTimestamp); } delta += mTimestamps[mBufferOut] - mOldTimestamp; if (delta > 500000000 || delta < 0) { //Log.d(TAG,"permits: "+mBufferCommitted.availablePermits()); delta = 0; } } mReport.update(mPackets[mBufferOut].Length, (mTimestamps[mBufferOut] / 100L) * (mClock / 1000L) / 10000L); mOldTimestamp = mTimestamps[mBufferOut]; if (mCount++ > 30) { if (mTransport == TRANSPORT_UDP) { mSocket.Send(mPackets[mBufferOut]); } else { sendTCP(); } } if (++mBufferOut >= mBufferCount) { mBufferOut = 0; } mBufferRequested.Release(); } } catch (Java.Lang.Exception e) { e.printStackTrace(); } mThread = null; resetFifo(); }
private void TecentPayPay(object sender, EventArgs args) { _msgApi.RegisterApp(Constants.AppId); var checkRunnable = new Runnable(() => { string url = string.Format("https://api.mch.weixin.qq.com/pay/unifiedorder"); string entity = GenProductArgs(); var buf = Util.httpPost(url, entity); string content = System.Text.Encoding.Default.GetString(buf); _resultunifiedorder = DecodeXml(content); var msg = new Message { What = (int)MsgWhat.TencentValidateFlag, Obj = content }; _handler.SendMessage(msg); }); Java.Lang.Thread checkThread = new Java.Lang.Thread(checkRunnable); checkThread.Start(); }
public void UncaughtException(Thread thread, Throwable ex) { Insights.Report(ex); }