private void fmRegister_Load(object sender, EventArgs e) { LoadPosition(); RegisterCheck reg = new RegisterCheck(); if (reg.IsRegister() == true) { txtEmail.Text = Utility.ReadAppRegistry("TVKing2", "email"); txtKey.Text = Utility.ReadAppRegistry("TVKing2", "license"); txtEmail.Enabled = false; txtKey.Enabled = false; picUnlock.Enabled = false; } switch (AppConst.appType) { case RegisterType.Ads: break; case RegisterType.Free: txtKey.Text = "FREE"; txtKey.Enabled = false; break; case RegisterType.Hours: break; case RegisterType.HoursDaily: break; case RegisterType.Trial: break; } }
static void Main() { //Application.EnableVisualStyles(); //Application.SetCompatibleTextRenderingDefault(false); //Application.Run(new TestForm()); //return; bool createdNew; DevExpress.Skins.SkinManager.Default.RegisterAssembly(typeof(DevExpress.UserSkins.TVKingSkin).Assembly); //Register! Utility.WriteLog("===========start---------" + AppConst.Version, 2000); System.Threading.Mutex appMutex = new System.Threading.Mutex(true, Application.ProductName, out createdNew); if (createdNew) { RegisterCheck reg = new RegisterCheck(); switch (AppConst.appType) { case RegisterType.Ads: Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ShowMainForm(); break; case RegisterType.Free: Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ShowMainForm(); break; case RegisterType.Hours: Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ShowMainForm(); break; case RegisterType.HoursDaily: Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ShowMainForm(); break; case RegisterType.Trial: if (reg.IsRegister() == false && reg.IsExpired() == true) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new fmRegister(true)); } break; } } else { string msg = String.Format("The Program \"{0}\" is already running", Application.ProductName); MessageBox.Show(msg, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void MakeUnlock() { RegisterCheck reg = new RegisterCheck(); bool registerresult = false; switch (AppConst.appType) { case RegisterType.Ads: registerresult = reg.Register(txtEmail.Text, txtKey.Text); break; case RegisterType.Free: registerresult = reg.Register3(txtEmail.Text); break; case RegisterType.Hours: registerresult = reg.Register2(txtEmail.Text, txtKey.Text); break; case RegisterType.HoursDaily: registerresult = reg.Register2(txtEmail.Text, txtKey.Text); break; case RegisterType.Trial: registerresult = reg.Register(txtEmail.Text, txtKey.Text); break; } if (registerresult == true) { Utility.WriteAppRegistry("TVKing2", "email", txtEmail.Text); Utility.WriteAppRegistry("TVKing2", "license", txtKey.Text); MessageBox.Show("Thank for your registration. Please restart this application."); this.Close(); } else { MessageBox.Show("Register key is not correct."); } }
private void Form1_Load(object sender, EventArgs e) { //default seeking bar for youtube channel tvkSeeking.is_show_icons = false; tvkSeeking.value = 0; //show version on title labelVersion.Text = "Version: " + AppConst.Version; //check if those 2 files exists on same folder if (!Utility.IsFileExist("fav.txt")) Utility.WriteFile("fav.txt", "", true); if (!Utility.IsFileExist("log.txt")) Utility.WriteFile("log.txt", "", true); //load configuration parameters from server LoadServerConfig(); //set default country defaultCountry = Utility.ReadAppRegistry("TVKing2", "default_country"); if (defaultCountry == "") { defaultCountry = "India"; } //checked register switch (AppConst.appType) { case RegisterType.Ads: barTrialHours.Visible = false; break; case RegisterType.Free: lbLeftDays.Visible = false; label10.Visible = false; label11.Text = "Register to watch OnlineTV UNLIMITED for FREE!"; lbRegisterText.Text = AppConst.TrialHours + " Hours watching TV"; label11.Left = lbRegisterText.Left; label11.Top = lbRegisterText.Top + 20; break; case RegisterType.Hours: lbLeftDays.Visible = false; label10.Visible = false; label11.Text = "You are using Trial version. Please Register to remove Time Limit"; lbRegisterText.Text = AppConst.TrialHours + " Hours watching TV"; label11.Left = lbRegisterText.Left; label11.Top = lbRegisterText.Top + 20; break; case RegisterType.HoursDaily: barTrialHours.Visible = false; break; case RegisterType.Trial: barTrialHours.Visible = false; break; } //search keyword text to empty lbListTitle.Text = ""; //set events for customed lists cbCategory.IndexChanged += new TVKing2.TVKComboBoxIndexChangedEvent(tvkComboBox2_IndexChanged); cbCountry.IndexChanged += new TVKing2.TVKComboBoxIndexChangedEvent(cbCountry_IndexChanged); lvStream.RatingClick += new DeRatingClick(lvStream_RatingClick); lvWeb.RatingClick += new DeRatingClick(lvStream_RatingClick); lvStream.DefaultClick += new DeTVKDefaultClick(lvStream_DefaultClick); //set height for customed lists cbCategory.SetListHeigh(150); cbCountry.SetListHeigh(250); //set channel title to empty txtTitle.Text = ""; //check register RegisterCheck reg = new RegisterCheck(); bool registerCheck = reg.IsRegister(); registerCheck = true; if (registerCheck == true) { registerToolStripMenuItem.Enabled = false; tvkLabel2.Visible = false; tvkPictureBox2.Visible = false; lbRegisterText.Visible = false; lbLeftDays.Visible = false; label10.Visible = false; label11.Visible = false; barTrialHours.Visible = false; switch (AppConst.appType) { case RegisterType.Free: registerToolStripMenuItem1.Text = "Free Version"; registerToolStripMenuItem1.Visible = true; registerToolStripMenuItem1.Enabled = false; break; case RegisterType.Hours: case RegisterType.Ads: case RegisterType.HoursDaily: case RegisterType.Trial: registerToolStripMenuItem1.Text = "Registering"; registerToolStripMenuItem1.Visible = true; if (reg.IsRegister() == true) registerToolStripMenuItem1.Enabled = false; else registerToolStripMenuItem1.Enabled = true; break; } } else { switch (AppConst.appType) { case RegisterType.Ads: lbRegisterText.Text = "Please register to watch TV Without Ads"; lbLeftDays.Text = ""; label10.Text = ""; adv = new fmAdvertisement(); adv.Show(); tmAdvMoving.Enabled = true; break; case RegisterType.Free: break; case RegisterType.Hours: reg.SetTimeUsed(); int timeLeft = reg.GetTimeLeft(); if (timeLeft < 0) { fmReg.Show(); } break; case RegisterType.HoursDaily: break; case RegisterType.Trial: if (reg.IsExpired() == true) { isStop = true; fmReg.Show(); tvkTrialScreen1.Visible = true; pbErrorBG.Visible = true; } lbLeftDays.Text = reg.GetDayLeft() + " Days"; break; } } //get country and category from server Thread thCountry = new Thread(new ThreadStart(LoadCountry)); Thread thCategory = new Thread(new ThreadStart(LoadCategory)); thCountry.Start(); thCategory.Start(); //load flags into memory LoadFlags(); //create folder to store channel logos string logFolder = Directory.GetCurrentDirectory() + @"\logos"; if (!Directory.Exists(logFolder)) Directory.CreateDirectory(logFolder); //pre-set location of all controls in main form LocateControls(); //show main logo on center of main form pbErrorBG.Visible = true; //set loaded flags for stream and web control lvStream.SetImageList(flagList); lvStream.Clear(); lvWeb.SetImageList(flagList); lvWeb.Clear(); //set some default properties for windows media player player_wmp.Visible = false; player_wmp.uiMode = "none"; player_wmp.stretchToFit = true; //show stop button pbStopSearch.Visible = false; //check version and update if it is old version Thread thCheckVersion = new Thread(new ThreadStart(InitCheckVersion)); thCheckVersion.Start(); //auto searching by default country SearchQuery(defaultCountry, true, false); SelectLabel(labelIndia); //set timer auto play checking if there is channel to play automatically bool isAutoplay = true; if (Utility.ReadAppRegistry("TVKing2", "auto_play") == "0") isAutoplay = false; if (isAutoplay) { tmAutoPlay.Enabled = true; } //set register form to the top fmReg.TopMost = true; //timer checking channel bandwidth is on tmBandwidth.Enabled = true; //download list of watchable channels DownloadCheckedList(); if (server_config_ads == true) { tvkads = new TVKAdsRight(AppConst.ServerURL); tvkads.Show(); timerRightBanner.Enabled = true; } //close startup flash flashpop.Close(); //get user harddrive id and submit to server systemuser.deFinishedGetSystemUser = new DeFinishedGetSystemUser(CallbackFinishedGetSystemUser); Thread threadSystemUser = new Thread(new ThreadStart(systemuser.RequestToServer)); threadSystemUser.Start(); timerSystemUser.Enabled = true; GetUserEmail(); //put more text on title to indicate version type switch (AppConst.appType) { case RegisterType.Ads: break; case RegisterType.Free: break; case RegisterType.Hours: break; case RegisterType.HoursDaily: if (reg.IsRegister() == false) { labelVersion.Text += " - 10 Minutes FREE watching"; Graphics g = labelVersion.CreateGraphics(); labelVersion.Width = (int)g.MeasureString(labelVersion.Text, labelVersion.Font).Width; g.Dispose(); } break; case RegisterType.Trial: break; } }
private void tmPlaying_Tick(object sender, EventArgs e) { try { RegisterCheck reg = new RegisterCheck(); reg.callback = this; switch (AppConst.appType) { case RegisterType.Ads: break; case RegisterType.Free: break; case RegisterType.Hours: if (reg.IsRegister() == false) { reg.SetTimeUsed(); int timeLeft = reg.GetTimeLeft(); barTrialHours.Maximum = AppConst.TrialHours * 60; if (timeLeft >= 0) barTrialHours.Value = timeLeft; if (isVideoPlaying == true) { if (timeLeft < 0) { isVideoPlaying = false; //if (isLoadVideo == true) // player.stop(); if (currentPlayingChannel.channel_type == AppConst.STREAM_TYPE_FLASH) player_flash.Movie = "http://"; player_wmp.URL = ""; fmReg.Show(); } } } break; case RegisterType.HoursDaily: if (reg.IsRegister() == false) { reg.SetTimeUsedHourDaily(); if (reg.IsExpired() == true) { if (isVideoPlaying == true) { isVideoPlaying = false; if (currentPlayingChannel.channel_type == AppConst.STREAM_TYPE_FLASH) player_flash.Movie = "http://"; player_wmp.URL = ""; fmReg.Show(); } } } break; case RegisterType.Trial: break; } } catch (Exception ex) { Utility.WriteLog(ex.Message); Utility.WriteLog(ex.StackTrace); } }
public void FinishedSetTimeHourDaily(int secondLeft) { RegisterCheck reg = new RegisterCheck(); if (reg.IsRegister() == false) { int second = secondLeft % 60; int minute = (secondLeft-second) / 60; labelVersion.Text = "Version: " + AppConst.Version; labelVersion.Text += " - " + minute + ":" + second + " Minutes FREE watching"; } }
private void lvWeb_MouseDoubleClick(object sender, MouseEventArgs e) { RegisterCheck reg = new RegisterCheck(); if (reg.IsRegister() == false) { switch (AppConst.appType) { case RegisterType.Ads: lbRegisterText.Text = "Please register to watch TV Without Ads"; lbLeftDays.Text = ""; label10.Text = ""; adv = new fmAdvertisement(); adv.Show(); tmAdvMoving.Enabled = true; return; case RegisterType.Free: break; case RegisterType.Hours: reg.SetTimeUsed(); int timeLeft = reg.GetTimeLeft(); if (timeLeft < 0) { fmReg.Show(); } return; case RegisterType.HoursDaily: if (reg.IsRegister() == false && reg.IsExpired() == false) { isStop = true; fmReg.Show(); tvkTrialScreen1.Visible = true; pbErrorBG.Visible = true; return; } break; case RegisterType.Trial: if (reg.IsExpired() == true) { isStop = true; fmReg.Show(); tvkTrialScreen1.Visible = true; pbErrorBG.Visible = true; } lbLeftDays.Text = reg.GetDayLeft() + " Days"; return; } } string selectedId = lvWeb.SelectedId(); foreach (Channel ch in webList) { if (ch.id.ToString() == selectedId) { System.Diagnostics.Process.Start(ch.web); break; } } }
private void LoadingChannelSuccess(bool is_youtube = false) { isVideoPlaying = true; if (is_youtube == false) { if (last_sending_success != currentPlayingChannel.id) { last_sending_success = currentPlayingChannel.id; RequestTVKServer sv = new RequestTVKServer(); sv.ChannelChecked(currentPlayingChannel.id); txtTitle.Text = currentPlayingChannel.name; } } //if (currentPlayingChannel.channel_type != "4" && currentPlayingChannel.channel_type != "1") // isLoadVideo = true; barText.Visible = false; barProgress.Visible = false; pnStatus.Visible = false; pbErrorBG.Visible = false; txtTitle.Visible = true; //txtDescription.Visible = true; //txtDescription.Text = currentPlayingChannel.description; pbMinimize.Visible = true; if (isShownAds == false) { switch (AppConst.appType) { case RegisterType.Ads: RegisterCheck reg = new RegisterCheck(); if (reg.IsRegister() == false) { ShowAdsOnChannel(); } break; case RegisterType.Free: break; case RegisterType.Hours: break; case RegisterType.HoursDaily: break; case RegisterType.Trial: break; } } }