public static void HideWaitCursor() { if (_waitCursor != null) { _waitCursor.Dispose(); _waitCursor = null; } }
// All kind of stuff because of the wait cursor ;-) private void DownloadWorker(object sender, DoWorkEventArgs e) { Thread.CurrentThread.Name = "Wikipedia"; _workerCompleted = false; using (WaitCursor cursor = new WaitCursor()) { lock (this) { if (!txtArticle.IsVisible) { GUIControl.ShowControl(GetID, txtArticle.GetID); } if (imageControl.IsVisible) { GUIControl.HideControl(GetID, imageControl.GetID); } if (!searchtermLabel.IsVisible) { GUIControl.ShowControl(GetID, searchtermLabel.GetID); } if (imagedescLabel.IsVisible) { GUIControl.HideControl(GetID, imagedescLabel.GetID); } if (buttonBack.IsVisible) { GUIControl.HideControl(GetID, buttonBack.GetID); } linkArray.Clear(); imagenameArray.Clear(); imagedescArray.Clear(); searchtermLabel.Label = e.Argument.ToString(); WikipediaArticle article = new WikipediaArticle(e.Argument.ToString(), language); articletext = article.GetArticleText(); linkArray = article.GetLinkArray(); imagenameArray = article.GetImageArray(); imagedescArray = article.GetImagedescArray(); language = article.GetLanguage(); if (articletext == "REDIRECT") { txtArticle.Label = GUILocalizeStrings.Get(2509) + "\n" + GUILocalizeStrings.Get(2510); //This page is only a redirect. Please chose the redirect aim from the link list. } else if (articletext == string.Empty) { txtArticle.Label = GUILocalizeStrings.Get(2504); //Sorry, no Article was found for your searchterm... } else { txtArticle.Label = articletext; } } } _workerCompleted = true; }
private void HideWaitCursor() { if (waitCursor != null) { waitCursor.Dispose(); waitCursor = null; } }
private void ShowWaitCursor() { waitCursor = new WaitCursor(); }
private void ImageWorker(object data) { lock (_downloadLock) { using (WaitCursor cursor = new WaitCursor()) { //GUIGraphicsContext.form.Invoke(new ThreadUpdateImage(updateDetailImage), new object[] { (string)data }); updateDetailImage((string)data); } } }
private void ZoomBackGround(float fZoom) { if (fZoom > MAX_ZOOM_FACTOR || fZoom < 0.0f) { return; } // to make it possibel to reach a 100% zoom level without changing the slideshow code, this condition are used //if (_isSlideShow) // _isPictureZoomed = _userZoomLevel == 1.0f ? false : true; //else // _isPictureZoomed = _userZoomLevel == _defaultZoomFactor ? false : true; // Load raw picture when zooming if (!_backgroundSlide.TrueSizeTexture && _isPictureZoomed) { _zoomInfoVisible = true; _isLoadingRawPicture = true; using (WaitCursor cursor = new WaitCursor()) { Thread WorkerThread = new Thread(LoadRawPictureThread); WorkerThread.IsBackground = true; WorkerThread.Name = "PicRawLoader"; WorkerThread.Start(); // Update window while (_isLoadingRawPicture) { GUIWindowManager.Process(); } // load picture //_backgroundTexture=GetSlide(true, out _backgroundSlide.Width,out _backgroundSlide.Height, out _currentSlideFileName); //_isLoadingRawPicture=false; } fZoom = _defaultZoomFactor * _userZoomLevel; } // Start and End point positions along the picture rectangle // Point zoom in/out only works if the selected Point is at the border // example: "m_dwWidthBackGround == m_iZoomLeft + _zoomWidth" and zooming to the left (iZoomType=4) float middlex = _zoomLeftBackground + _zoomWidth / 2; float middley = _zoomTopBackground + _zoomHeight / 2; float xend = _backgroundSlide.Width; float yend = _backgroundSlide.Height; _zoomFactorBackground = fZoom; float x, y, width, height; GetOutputRect(_backgroundSlide.Width, _backgroundSlide.Height, _zoomFactorBackground, out x, out y, out width, out height); if (_isPictureZoomed) { _zoomTypeBackground = 0; } switch (_zoomTypeBackground) { /* 0: // centered, centered * 1: // Top Left unchanged * 2: // Width centered, Top unchanged * 3: // Top Right unchanged * 4: // Height centered, Right unchanged * 5: // Bottom Right unchanged * 6: // Widht centered, Bottom unchanged * 7: // Bottom Left unchanged * 8: // Heigth centered, Left unchanged * */ case 0: // centered, centered _zoomLeftBackground = middlex - _zoomWidth * 0.5f; _zoomTopBackground = middley - _zoomHeight * 0.5f; break; case 2: // Width centered, Top unchanged _zoomLeftBackground = middlex - _zoomWidth * 0.5f; break; case 8: // Heigth centered, Left unchanged _zoomTopBackground = middley - _zoomHeight * 0.5f; break; case 6: // Widht centered, Bottom unchanged _zoomLeftBackground = middlex - _zoomWidth * 0.5f; _zoomTopBackground = yend - _zoomHeight; break; case 4: // Height centered, Right unchanged _zoomTopBackground = middley - _zoomHeight * 0.5f; _zoomLeftBackground = xend - _zoomWidth; break; case 1: // Top Left unchanged break; case 3: // Top Right unchanged _zoomLeftBackground = xend - _zoomWidth; break; case 7: // Bottom Left unchanged _zoomTopBackground = yend - _zoomHeight; break; case 5: // Bottom Right unchanged _zoomTopBackground = yend - _zoomHeight; _zoomLeftBackground = xend - _zoomWidth; break; } if (_zoomLeftBackground > _backgroundSlide.Width - _zoomWidth) { _zoomLeftBackground = (_backgroundSlide.Width - _zoomWidth); } if (_zoomTopBackground > _backgroundSlide.Height - _zoomHeight) { _zoomTopBackground = (_backgroundSlide.Height - _zoomHeight); } if (_zoomLeftBackground < 0) { _zoomLeftBackground = 0; } if (_zoomTopBackground < 0) { _zoomTopBackground = 0; } }
public override bool Play(string strFile) { _isCDA = false; _graphState = PlayState.Init; _currentFile = strFile; Log.Info("AudioPlayerWMP9: Disabling DX9 exclusive mode"); GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_SWITCH_FULL_WINDOWED, 0, 0, 0, 0, 0, null); GUIWindowManager.SendMessage(msg); _notifyPlaying = true; GC.Collect(); CreateInstance(); LoadStreamingSettings(); if (_wmp10Player == null) { return false; } if (_wmp10Player.cdromCollection == null) { return false; } VideoRendererStatistics.VideoState = VideoRendererStatistics.State.VideoPresent; _wmp10Player.PlayStateChange += new _WMPOCXEvents_PlayStateChangeEventHandler(OnPlayStateChange); _wmp10Player.Buffering += new _WMPOCXEvents_BufferingEventHandler(OnBuffering); //_wmp10Player.enableContextMenu = false; //_wmp10Player.Ctlenabled = false; if (strFile.IndexOf("cdda:") >= 0) { string strTrack = strFile.Substring(5); int iTrack = Convert.ToInt32(strTrack); if (_wmp10Player.cdromCollection.count <= 0) { return false; } if (_wmp10Player.cdromCollection.Item(0).Playlist == null) { return false; } if (iTrack > _wmp10Player.cdromCollection.Item(0).Playlist.count) { return false; } _wmp10Player.currentMedia = _wmp10Player.cdromCollection.Item(0).Playlist.get_Item(iTrack - 1); if (_wmp10Player.currentMedia == null) { return false; } _isCDA = true; Log.Info("Audioplayer: play track:{0}/{1}", iTrack, _wmp10Player.cdromCollection.Item(0).Playlist.count); } else if (strFile.IndexOf(".cda") >= 0) { string strTrack = ""; int pos = strFile.IndexOf(".cda"); if (pos >= 0) { pos--; while (Char.IsDigit(strFile[pos]) && pos > 0) { strTrack = strFile[pos] + strTrack; pos--; } } if (_wmp10Player.cdromCollection.count <= 0) { return false; } string strDrive = strFile.Substring(0, 1); strDrive += ":"; int iCdRomDriveNr = 0; while ((_wmp10Player.cdromCollection.Item(iCdRomDriveNr).driveSpecifier != strDrive) && (iCdRomDriveNr < _wmp10Player.cdromCollection.count)) { iCdRomDriveNr++; } int iTrack = Convert.ToInt32(strTrack); if (_wmp10Player.cdromCollection.Item(iCdRomDriveNr).Playlist == null) { return false; } int tracks = _wmp10Player.cdromCollection.Item(iCdRomDriveNr).Playlist.count; if (iTrack > tracks) { return false; } _wmp10Player.currentMedia = _wmp10Player.cdromCollection.Item(iCdRomDriveNr).Playlist.get_Item(iTrack - 1); if (_wmp10Player.currentMedia == null) { return false; } /* string strStart=strFile.Substring(0,2)+@"\"; int ipos=strFile.LastIndexOf("+"); if (ipos >0) strStart += strFile.Substring(ipos+1); strFile=strStart; _currentFile=strFile; Log.Info("Audioplayer:play {0}", strFile);*/ //_wmp10Player.URL=strFile; _currentFile = strFile; _isCDA = true; } else { Log.Info("Audioplayer:play {0}", strFile); _wmp10Player.URL = strFile; } _wmp10Player.Ctlcontrols.play(); _wmp10Player.ClientSize = new Size(0, 0); _wmp10Player.Visible = false; // When file is internetstream if (_wmp10Player.URL.StartsWith("http") || _wmp10Player.URL.StartsWith("mms") || _wmp10Player.URL.StartsWith("HTTP") || _wmp10Player.URL.StartsWith("MMS")) { _bufferCompleted = false; using (WaitCursor waitcursor = new WaitCursor()) { GUIGraphicsContext.Overlay = false; while (_bufferCompleted != true) { { // if true then could not load stream if (_wmp10Player.playState.Equals(WMPPlayState.wmppsReady)) { _bufferCompleted = true; } if (GUIGraphicsContext.Overlay) { GUIGraphicsContext.Overlay = false; } _graphState = PlayState.Playing; GUIWindowManager.Process(); } } GUIGraphicsContext.Overlay = true; } if (_bufferCompleted && _wmp10Player.playState.Equals(WMPPlayState.wmppsReady)) { Log.Info("Audioplayer: failed to load {0}", strFile); return false; } } GUIMessage msgPb = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAYBACK_STARTED, 0, 0, 0, 0, 0, null); msgPb.Label = strFile; GUIWindowManager.SendThreadMessage(msgPb); _graphState = PlayState.Playing; GC.Collect(); _needUpdate = true; _isFullScreen = GUIGraphicsContext.IsFullScreenVideo; _positionX = GUIGraphicsContext.VideoWindow.Left; _positionY = GUIGraphicsContext.VideoWindow.Top; _videoWidth = GUIGraphicsContext.VideoWindow.Width; _videoHeight = GUIGraphicsContext.VideoWindow.Height; SetVideoWindow(); return true; }
//Do a complete download, parse and update private void RefreshMe(bool autoUpdate) { lock (_downloadLock) { using (WaitCursor cursor = new WaitCursor()) { //message strings for refresh of images if (!Directory.Exists(Config.GetFolder(Config.Dir.Cache))) { Directory.CreateDirectory(Config.GetFolder(Config.Dir.Cache)); } string weatherFile = Config.GetFile(Config.Dir.Cache, "curWeather.xml"); bool dlRes = false, ldRes = false; //Do The Download dlRes = Download(weatherFile); if (dlRes) //dont load if download failed { ldRes = ParseWeatherInfoFromFile(weatherFile); //parse } //if the download or load failed, display an error message if ((!dlRes || !ldRes) && !autoUpdate) //this will probably crash on an autoupdate as well, but not tested { // show failed dialog... GUIDialogOK errorDialog = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK); errorDialog.SetHeading(412); //"Unable to get weather data" errorDialog.SetLine(1, _nowLabelLocation); errorDialog.SetLine(2, string.Empty); errorDialog.SetLine(3, string.Empty); errorDialog.DoModal(GetID); } else if (dlRes && ldRes) //download and load went ok so update { RefreshNewMode(); } _lastRefreshTime = DateTime.Now; _dayNum = -2; } } }
private void HideWaitCursor() { if (!WaitCursorActive && _WaitCursor == null && WaitCursorThread == null) { return; } WaitCursorActive = false; // Dispose of the WaitCursor object if (_WaitCursor != null) { _WaitCursor.Dispose(); _WaitCursor = null; } // Make sure the thread is dead if (WaitCursorThread != null) { if (WaitCursorThread.IsAlive) { WaitCursorThread.Abort(); } WaitCursorThread = null; } }
private void ShowWaitCursorAsync() { _WaitCursor = new WaitCursor(); while (WaitCursorActive) { Thread.Sleep(800); GUIWindowManager.Process(); } if (_WaitCursor != null) { _WaitCursor.Dispose(); _WaitCursor = null; } }
private void OnPlayStateChange(object sender, _WMPOCXEvents_PlayStateChangeEvent e) { Log.Debug("WMPlayer: _AxWMP.playStateChange: " + _AxWMP.playState.ToString()); switch (_AxWMP.playState) { case WMPLib.WMPPlayState.wmppsBuffering: if (_WaitCursor == null) _WaitCursor = new WaitCursor(); break; case WMPLib.WMPPlayState.wmppsPlaying: _WMPPlayCalled = false; if (_WaitCursor != null) { _WaitCursor.Dispose(); _WaitCursor = null; } break; case WMPLib.WMPPlayState.wmppsStopped: _AxWMP.Visible = false; _PlayState = PlayState.Ended; break; } }
void _BassPlayer_WaitCursorRequested(object sender, BASSPlayer.WaitCursorRequest request) { switch (request) { case BASSPlayer.WaitCursorRequest.On: if (_WaitCursor == null) { _WaitCursor = new WaitCursor(); } break; case BASSPlayer.WaitCursorRequest.Off: if (_WaitCursor != null) { _WaitCursor.Dispose(); _WaitCursor = null; } break; } }
public static void ShowWaitCursor() { if (waitCursor == null) { waitCursor = new WaitCursor(); } }