void Start() { Screen.orientation = ScreenOrientation.Portrait; Screen.autorotateToLandscapeLeft = false; Screen.autorotateToLandscapeRight = false; Screen.autorotateToPortrait = false; Screen.autorotateToPortraitUpsideDown = false; // ApplicationChrome.statusBarState = ApplicationChrome.States.TranslucentOverContent; ApplicationChrome.navigationBarState = ApplicationChrome.States.VisibleOverContent; ApplicationChrome.statusBarState = ApplicationChrome.States.Visible; credentialError.SetActive(false); credError = false; letsdefault = false; isCredentialError = false; originalRect = contentRect.offsetMin.y; GetComponent <RectTransform>().SetAsLastSibling(); isNavigationDone = false; _initialScrollContentSize = new Vector2(contentRect.rect.height, contentRect.rect.width); _bType = bType; _NaviStatus = NavigationStatus.NotProcessing; ResetIcons(); #if UNITY_EDITOR #elif UNITY_ANDROID AndroidJavaClass unity = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); _currentActivity = unity.GetStatic <AndroidJavaObject> ("currentActivity"); #endif }
public void CreateButtons(string _folder) { if (_NaviStatus == NavigationStatus.Processing) { return; } StartLoading(); _NaviStatus = NavigationStatus.Processing; _userDrive.GetSelectedFolderFileList(_folder, delegate(string resJson) { FinishLoading(); _NaviStatus = NavigationStatus.NotProcessing; _isReseting = true; if (storedButton.Count != 0) { DeletePanels(true, "dd"); } _userDrive.JobDone(); CreatePanels(resJson); _isReseting = false; }); }
public void DownloadButtonClick_Pre() { customView.GetComponent <CustomizeView>().DefaultValueSetting(); /* banned root folder * if (!_selectedButton && !(_selectedButton.GetComponent<ButtonType>().buttonType == "folder") && !(_NaviStatus == NavigationStatus.Processing) ) * return; */ StartLoading(); string str = _userDrive.GetRecentPath(); _NaviStatus = NavigationStatus.Processing; JSONNode parseResult = _recentParseResult; long totalFileSize = 0; for (int index = 0; index < parseResult["entries"].Count; index++) { if (parseResult["entries"][index][".tag"].Value == "folder") { continue; } else { string _extentionFormat = GetFileExtentionFormat(parseResult["entries"][index]["name"].Value); if (_extentionFormat == "jpg" || _extentionFormat == "JPG" || _extentionFormat == "png" || _extentionFormat == "PNG" || _extentionFormat == "Jpg" || _extentionFormat == "Png") { //Debug.Log(parseResult["entries"][index]["size"].Value); totalFileSize += Convert.ToInt64(parseResult["entries"][index]["size"].Value); } } } FinishLoading(); #if UNITY_EDITOR Debug.Log("Total File Size:" + totalFileSize); DownloadButtonClicked(); #elif UNITY_ANDROID long currentAvailableMemorySize = _currentActivity.CallStatic <long> ("GetAvailableMemory", Application.persistentDataPath); Debug.Log("Available Memory:" + currentAvailableMemorySize); if (totalFileSize > currentAvailableMemorySize) { /* ##Exceed File Memory for saving slides*/ Debug.Log("File Exceed"); ShowExceedMemory(); } else { DownloadButtonClicked(); } #endif }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { NavigationStatus status = (NavigationStatus)value; BrushCollection brushCollection = BrushDictionaries.NavigationStatusBackgroundBrushCollectionDictionary.GetBrushCollection(status); BrushCollectionProperty property = (BrushCollectionProperty)parameter; return(brushCollection.GetProperty(property)); }
// Update is called once per frame void Update() { if (_authCheck == AuthCheck.failed) { _timerForAuth += Time.deltaTime; if (_timerForAuth > 20.0f) { Icon_AuthFailed.SetActive(true); } } if (_userDrive != null) { _userDrive.Update(); } if (_isReseting == false) { ButtonListener(); } if (Input.GetKeyDown(KeyCode.Escape)) { Debug.Log(credError); if (!this.gameObject.activeSelf || _NaviStatus == NavigationStatus.Processing) { return; } Debug.Log("1"); _NaviStatus = NavigationStatus.Processing; //credentialError.SetActive(false); /*navigation back- go to parent paht*/ if (credError) { credentialError.SetActive(false); isCredentialError = true; } else if (_userDrive.GetRecentPath() != "/" || _userDrive.GetRecentPath() == _empty) { _userDrive.GetCurrParentFileList(delegate(string resJson) { _isReseting = true; _NaviStatus = NavigationStatus.NotProcessing; if (storedButton.Count != 0) { DeletePanels(true, "dd"); } _userDrive.JobDone(); CreatePanels(resJson); _isReseting = false; }); } } }
public void DownloadButtonClicked() { //customView.GetComponent<CustomizeView>().DefaultValueSetting(); try { string str = _userDrive.GetRecentPath(); _pptID = _setManager.BShowcaseMgr.AddShowcase("_empty", 0, "/_empty", 30, 5); _setManager.BShowcaseMgr.EditShowcase_path(_pptID, (Application.persistentDataPath + "/" + _pptID)); customView.GetComponent <CustomizeView>().SetPPTID(_pptID); bool isProgressbarStart = false; _userDrive.DonwloadAllFilesInFolder(str, Application.persistentDataPath + "/" + _pptID, delegate() { /* completed Callback */ #if UNITY_EDITOR Debug.Log("fileDownLoad Complete"); #endif _userDrive.JobDone(); _NaviStatus = NavigationStatus.NotProcessing; StartCoroutine("CompleteDownloading"); }, delegate(int totalFileNum, int completedFileNum) /* process Callback */ { ProgressBar progressBar = progressCircle.GetComponent <ProgressBar>(); if (completedFileNum == 0 && isProgressbarStart == false) { isProgressbarStart = true; ShowLoadingPanel(); progressBar.ResetProgress(); } progressBar.StartProgress(completedFileNum, totalFileNum); }, delegate() { /* Cancel Callback */ #if UNITY_EDITOR Debug.Log("fileDownLoad Canceled"); #endif _setManager.BShowcaseMgr.DeleteShowcase(_pptID); _userDrive.JobDone(); _NaviStatus = NavigationStatus.NotProcessing; loadingView.SetActive(false); }); } catch (Exception e) { _userDrive.JobDone(); _NaviStatus = NavigationStatus.NotProcessing; Debug.Log(e.ToString()); } }
public ClassAPositionReportLongRangeMessage(byte type, long timeStamp, byte repeatIndicator, uint mmsi, bool positionAcuracy, bool raimFlag, NavigationStatus navigationStatus, float longtitude, float latitude, float speedOverGround, float courseOverGround, bool gnssPosition, bool spare) : base(type, timeStamp) { RepeatIndicator = repeatIndicator; Mmsi = mmsi; PositionAcuracy = positionAcuracy; RaimFlag = raimFlag; NavigationStatus = navigationStatus; Longtitude = longtitude; Latitude = latitude; SpeedOverGround = speedOverGround; CourseOverGround = courseOverGround; GnssPosition = gnssPosition; Spare = spare; }
public void SetupCloud(int cloudType) { if (_NaviStatus == NavigationStatus.Processing) { return; } if (_userDrive == null) { _userDrive = new bUserCloudDrive(); } _currCloudType = cloudType; _userDrive.Setup(_googleDirve); _userDrive.Initialize(cloudType); StartLoading(); _NaviStatus = NavigationStatus.Processing; _userDrive.StartAuthentication(delegate(bool res, int resCode) { FinishLoading(); _NaviStatus = NavigationStatus.NotProcessing; if (res) { if (resCode == 1) { Debug.Log("Credential Error"); credentialError.gameObject.SetActive(true); credError = true; // close the application and retry again. } else { credentialError.gameObject.SetActive(false); _userDrive.GetFileListFromPath("/", CreatePanels); } _authCheck = AuthCheck.Succeed; _timerForAuth = 0; } else { _authCheck = AuthCheck.failed; Icon_AuthFailed.SetActive(true); } }); }
public AisMessage CreateMessage(BitArray payload) { var type = payload.DecodeByte(0, 5); if (type != c_type1 && type != c_type2 && type != c_type3) { throw new Exception(string.Format("Incorrect type, expected 1,2,3 but present:{0}", type)); } var timeStamp = DateTime.UtcNow.ToFileTimeUtc(); byte repeatIndicator = payload.DecodeByte(6, 7); uint mmsi = payload.DecodeUInt32(8, 37); NavigationStatus navStatus = (NavigationStatus)payload.DecodeByte(38, 41); int rot = payload.DecodeInt32(42, 49); float sog = (float)payload.DecodeUInt32(50, 59) / 10; bool posAccuracy = payload.DecodeBool(60); float longtitude = (float)payload.DecodeFloat(61, 88) / 600000; float latitude = (float)payload.DecodeFloat(89, 115) / 600000; float cog = (float)payload.DecodeUInt32(116, 127) / 10; ushort heading = payload.DecodeUShort(128, 136); byte utcSeconds = payload.DecodeByte(137, 142); ManeuverIndicator manuevrIndicator = (ManeuverIndicator)payload.DecodeByte(143, 144); byte spare = payload.DecodeByte(145, 147); bool raim = payload.DecodeBool(148); uint radioStatus = payload.DecodeUInt32(149, 167); return(new ClassAPositionReportMessage( type, timeStamp, repeatIndicator, mmsi, navStatus, rot, sog, posAccuracy, longtitude, latitude, cog, heading, utcSeconds, manuevrIndicator, spare, raim, radioStatus)); }
/// <summary> /// 引发 <see cref="E:System.Windows.Window.SourceInitialized"/> 事件。 /// </summary> /// <param name="e">一个 <see cref="T:System.EventArgs"/>,其中包含事件数据。</param> protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); this.CaptionTextBlock.Text = Caption; if (!DesignerProperties.GetIsInDesignMode(this)) { this.MainFrameNavigationStatus = new NavigationStatus(this.MainFrame.NavigationService); App.UserConfigChanged += this.App_UserConfigChanged; this.MainPage = new MainPage(); this.MainPage.VideoSelected += this.MainPage_VideoSelected; this.MainFrame.Navigate(this.MainPage); OnShowMessage += this.MainWindow_OnShowMessage; this.BeginRefresh(); } }
public ClassAPositionReportMessage(byte type, long timeStamp, byte repeatIndicator, uint mmsi, NavigationStatus navigationStatus, int rateOfTurn, float speedOverGround, bool positionAcuracy, float longtitude, float latitude, float courseOverGround, ushort trueHeading, byte utcSeconds, ManeuverIndicator maneuverIndicator, byte spare, bool raimFlag, uint radioStatus) : base(type, timeStamp) { RepeatIndicator = repeatIndicator; Mmsi = mmsi; NavigationStatus = navigationStatus; RateOfTurn = rateOfTurn; SpeedOverGround = speedOverGround; PositionAcuracy = positionAcuracy; Longtitude = longtitude; Latitude = latitude; CourseOverGround = courseOverGround; TrueHeading = trueHeading; UtcSeconds = utcSeconds; ManeuverIndicator = maneuverIndicator; Spare = spare; RaimFlag = raimFlag; RadioStatus = radioStatus; }
public void Initialize() { ResetIcons(); _NaviStatus = NavigationStatus.NotProcessing; _authCheck = AuthCheck.failed; _currCloudType = 0; isButtonSelected = false; //ETC _empty = ""; _isReseting = false; _isCopy = false; credentialError.SetActive(false); credError = false; FinishLoading(); }
public void ClickLogoutButton() { if (_authCheck == AuthCheck.Succeed) { if (_NaviStatus == NavigationStatus.Processing) { return; } _NaviStatus = NavigationStatus.Processing; _userDrive.Revoke(delegate(){ _NaviStatus = NavigationStatus.NotProcessing; if (_currCloudType != 0) { ClearPanels(); SetupCloud(_currCloudType); } }); } }
public AisMessage CreateMessage(BitArray payload) { var type = payload.DecodeByte(0, 5); if (type != c_type1) { throw new Exception(string.Format("Incorrect type, expected 27 but present:{0}", type)); } var timeStamp = DateTime.UtcNow.ToFileTimeUtc(); byte repeatIndicator = payload.DecodeByte(6, 7); uint mmsi = payload.DecodeUInt32(8, 37); bool posAccuracy = payload.DecodeBool(38); bool raim = payload.DecodeBool(39); NavigationStatus navStatus = (NavigationStatus)payload.DecodeByte(40, 43); float longtitude = (float)payload.DecodeFloat(44, 61) / 600000; float latitude = (float)payload.DecodeFloat(62, 78) / 600000; float sog = (float)payload.DecodeUInt32(79, 84) / 10; float cog = (float)payload.DecodeUInt32(85, 93) / 10; bool gnss = payload.DecodeBool(94); bool spare = payload.DecodeBool(95); return(new ClassAPositionReportLongRangeMessage( type, timeStamp, repeatIndicator, mmsi, posAccuracy, raim, navStatus, longtitude, latitude, sog, cog, gnss, spare)); }
/// <summary> /// Unmarshals the data stored in the specified <paramref name="buffer"/> into this /// <see cref="NcomPacket"/>. If no marshalled NCOM packet can be found, /// <see langword="false"/> is returned. /// </summary> /// <param name="buffer">The byte array containing the marshalled NCOM packet.</param> /// <param name="offset"> /// The zero-based index indicating the location in the buffer to start looking for a sync /// byte from. /// </param> /// <returns> /// <see langword="false"/> if no marshalled NCOM packet can be found, otherwise /// <see langword="true"/>. /// </returns> /// <exception cref="ArgumentNullException"> /// When the <paramref name="buffer"/> is null. /// </exception> /// <exception cref="IndexOutOfRangeException"> /// When the <paramref name="offset"/> is less than <c>0</c>. /// </exception> /// <remarks> /// <para> /// If the first byte of the buffer is not <see cref="SyncByte"/> then the method will look /// for the first occurance of the sync byte. /// </para> /// <para> /// The <paramref name="offset"/> can be greater than the length of the /// <paramref name="buffer"/> without throwing an exception, returning /// <see langword="false"/>. This allows for easy unmarshalling of multiple consecutive /// packets, e.g. <see langword="while" /> loops. /// </para> /// </remarks> public virtual bool Unmarshal(byte[] buffer, int offset) { // Check that the buffer is not null if (buffer == null) { throw new ArgumentNullException(nameof(buffer)); } // Check that the offset is in the expected range if (offset < 0) { throw new IndexOutOfRangeException("Offset in buffer can not be less than zero"); } // Seek the sync byte while (offset <= buffer.Length - PacketLength) { // Have we found the sync byte? if (buffer[offset++] == SyncByte) { // packet found. offset now points to [1] // Get navigation status byte NavigationStatus = ByteHandling.ParseEnum(buffer[offset + 20], NavigationStatus.Unknown); // Calculate Checksum 3 Checksum3 = CalculateChecksum(buffer, offset, 70) == buffer[offset + PacketLength - 2]; // Unmarshalled OK, return true return(true); } } // Couldn't find packet, return false; return(false); }
public void ThenNmeaAisLongRangeAisBroadcastParser_NavigationStatusIs(NavigationStatus navigationStatus) { this.Then(parser => Assert.AreEqual(navigationStatus, parser.NavigationStatus)); }
void Start() { Screen.orientation = ScreenOrientation.Portrait; Screen.autorotateToLandscapeLeft = false; Screen.autorotateToLandscapeRight = false; Screen.autorotateToPortrait = false; Screen.autorotateToPortraitUpsideDown = false; // ApplicationChrome.statusBarState = ApplicationChrome.States.TranslucentOverContent; ApplicationChrome.navigationBarState = ApplicationChrome.States.VisibleOverContent; ApplicationChrome.statusBarState = ApplicationChrome.States.Visible; credentialError.SetActive(false); credError = false; letsdefault = false; isCredentialError = false; originalRect = contentRect.offsetMin.y; GetComponent<RectTransform>().SetAsLastSibling(); isNavigationDone = false; _initialScrollContentSize = new Vector2(contentRect.rect.height, contentRect.rect.width); _bType = bType; _NaviStatus = NavigationStatus.NotProcessing; ResetIcons (); #if UNITY_EDITOR #elif UNITY_ANDROID AndroidJavaClass unity = new AndroidJavaClass ("com.unity3d.player.UnityPlayer"); _currentActivity = unity.GetStatic<AndroidJavaObject> ("currentActivity"); #endif }
public void MemoryWarningOkButtonClick() { warningMemoryPanel.SetActive(false); _NaviStatus = NavigationStatus.NotProcessing; }
public void ClickLogoutButton(){ if (_authCheck == AuthCheck.Succeed) { if (_NaviStatus == NavigationStatus.Processing) return; _NaviStatus = NavigationStatus.Processing; _userDrive.Revoke (delegate(){ _NaviStatus = NavigationStatus.NotProcessing; if(_currCloudType != 0){ ClearPanels(); SetupCloud(_currCloudType); } }); } }
public void ThenAisPositionReportClassAParser_NavigationStatusIs(NavigationStatus navigationStatus) { this.Then(parser => Assert.AreEqual(navigationStatus, parser.NavigationStatus)); }
public void CreateButtons(string _folder) { if (_NaviStatus == NavigationStatus.Processing) return; StartLoading (); _NaviStatus = NavigationStatus.Processing; _userDrive.GetSelectedFolderFileList(_folder, delegate (string resJson) { FinishLoading(); _NaviStatus = NavigationStatus.NotProcessing; _isReseting = true; if (storedButton.Count != 0) { DeletePanels(true, "dd"); } _userDrive.JobDone(); CreatePanels(resJson); _isReseting = false; }); }
public void SetupCloud(int cloudType) { if (_NaviStatus == NavigationStatus.Processing) return; if (_userDrive == null) _userDrive = new bUserCloudDrive(); _currCloudType = cloudType; _userDrive.Setup(_googleDirve); _userDrive.Initialize(cloudType); StartLoading (); _NaviStatus = NavigationStatus.Processing; _userDrive.StartAuthentication(delegate (bool res, int resCode) { FinishLoading(); _NaviStatus = NavigationStatus.NotProcessing; if (res) { if(resCode == 1){ Debug.Log("Credential Error"); credentialError.gameObject.SetActive(true); credError = true; // close the application and retry again. } else{ credentialError.gameObject.SetActive(false); _userDrive.GetFileListFromPath("/", CreatePanels); } _authCheck = AuthCheck.Succeed; _timerForAuth = 0; }else{ _authCheck = AuthCheck.failed; Icon_AuthFailed.SetActive(true); } }); }
// Update is called once per frame void Update () { if(_authCheck == AuthCheck.failed){ _timerForAuth += Time.deltaTime; if (_timerForAuth > 20.0f) { Icon_AuthFailed.SetActive (true); } } if (_userDrive != null) { _userDrive.Update(); } if (_isReseting == false) { ButtonListener(); } if (Input.GetKeyDown(KeyCode.Escape)) { Debug.Log(credError); if (!this.gameObject.activeSelf || _NaviStatus == NavigationStatus.Processing) return; Debug.Log("1"); _NaviStatus = NavigationStatus.Processing; //credentialError.SetActive(false); /*navigation back- go to parent paht*/ if (credError) { credentialError.SetActive(false); isCredentialError = true; } else if (_userDrive.GetRecentPath() != "/" || _userDrive.GetRecentPath() == _empty) { _userDrive.GetCurrParentFileList(delegate (string resJson) { _isReseting = true; _NaviStatus = NavigationStatus.NotProcessing; if (storedButton.Count != 0) { DeletePanels(true, "dd"); } _userDrive.JobDone(); CreatePanels(resJson); _isReseting = false; }); } } }
public static bool IsFault(this NavigationStatus navigationStatus) => NavigationFaultStates.Contains(navigationStatus);
public void DownloadButtonClick_Pre(){ customView.GetComponent<CustomizeView>().DefaultValueSetting(); /* banned root folder if (!_selectedButton && !(_selectedButton.GetComponent<ButtonType>().buttonType == "folder") && !(_NaviStatus == NavigationStatus.Processing) ) return; */ StartLoading (); string str = _userDrive.GetRecentPath(); _NaviStatus = NavigationStatus.Processing; JSONNode parseResult = _recentParseResult; long totalFileSize = 0; for (int index = 0; index < parseResult["entries"].Count; index++){ if (parseResult["entries"][index][".tag"].Value == "folder") { continue; }else{ string _extentionFormat = GetFileExtentionFormat( parseResult["entries"][index]["name"].Value); if (_extentionFormat == "jpg" || _extentionFormat == "JPG" || _extentionFormat == "png" || _extentionFormat == "PNG" || _extentionFormat == "Jpg" || _extentionFormat == "Png") { //Debug.Log(parseResult["entries"][index]["size"].Value); totalFileSize += Convert.ToInt64(parseResult["entries"][index]["size"].Value); } } } FinishLoading(); #if UNITY_EDITOR Debug.Log("Total File Size:" + totalFileSize); DownloadButtonClicked (); #elif UNITY_ANDROID long currentAvailableMemorySize = _currentActivity.CallStatic<long> ("GetAvailableMemory", Application.persistentDataPath); Debug.Log("Available Memory:" + currentAvailableMemorySize); if(totalFileSize > currentAvailableMemorySize){ /* ##Exceed File Memory for saving slides*/ Debug.Log("File Exceed"); ShowExceedMemory(); }else{ DownloadButtonClicked (); } #endif }
private void ResetPendingNavigationState(NavigationStatus newState) { // If this container is done loading decrement the window's NavigationService bytes by the final amts of this container JournalNavigationScope jns = JournalScope; if (jns != null && jns.RootNavigationService != this) { // If there were two child frames loading simultaneously, then rootNavigationService will reflect // only the remaining child's progress now else this will reset window's totals to zero jns.RootNavigationService.BytesRead -= _bytesRead; jns.RootNavigationService.MaxBytes -= _maxBytes; } _navStatus = newState; _bytesRead = 0; _maxBytes = 0; #if DEBUG // We should only be replacing queue items that aren't already posted Debug.Assert(_navigateQueueItem == null || _navigateQueueItem.IsPosted == false); #endif _navigateQueueItem = null; _request = null; }
public void DownloadButtonClicked() { //customView.GetComponent<CustomizeView>().DefaultValueSetting(); try { string str = _userDrive.GetRecentPath(); _pptID = _setManager.BShowcaseMgr.AddShowcase("_empty", 0, "/_empty", 30, 5); _setManager.BShowcaseMgr.EditShowcase_path(_pptID, (Application.persistentDataPath + "/" + _pptID)); customView.GetComponent<CustomizeView>().SetPPTID(_pptID); bool isProgressbarStart = false; _userDrive.DonwloadAllFilesInFolder(str, Application.persistentDataPath + "/" + _pptID, delegate () { /* completed Callback */ #if UNITY_EDITOR Debug.Log("fileDownLoad Complete"); #endif _userDrive.JobDone(); _NaviStatus = NavigationStatus.NotProcessing; StartCoroutine("CompleteDownloading"); }, delegate (int totalFileNum, int completedFileNum) /* process Callback */ { ProgressBar progressBar = progressCircle.GetComponent<ProgressBar>(); if(completedFileNum == 0 && isProgressbarStart == false){ isProgressbarStart = true; ShowLoadingPanel(); progressBar.ResetProgress(); } progressBar.StartProgress(completedFileNum, totalFileNum); }, delegate () {/* Cancel Callback */ #if UNITY_EDITOR Debug.Log("fileDownLoad Canceled"); #endif _setManager.BShowcaseMgr.DeleteShowcase(_pptID); _userDrive.JobDone(); _NaviStatus = NavigationStatus.NotProcessing; loadingView.SetActive(false); }); } catch (Exception e) { _userDrive.JobDone(); _NaviStatus = NavigationStatus.NotProcessing; Debug.Log(e.ToString()); } }
public void Initialize(){ ResetIcons (); _NaviStatus = NavigationStatus.NotProcessing; _authCheck = AuthCheck.failed; _currCloudType = 0; isButtonSelected = false; //ETC _empty = ""; _isReseting = false; _isCopy = false; credentialError.SetActive(false); credError = false; FinishLoading (); }