本文整理汇总了C#中Note.GetNoteAbsoluteHeight方法的典型用法代码示例。如果您正苦于以下问题:C# Note.GetNoteAbsoluteHeight方法的具体用法?C# Note.GetNoteAbsoluteHeight怎么用?C# Note.GetNoteAbsoluteHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Note
的用法示例。
在下文中一共展示了Note.GetNoteAbsoluteHeight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateNotes
protected void CreateNotes( )
{
try
{
// expect the note and its style sheet to exist.
NoteFileName = Rock.Mobile.Util.Strings.Parsers.ParseURLToFileName( NoteUrl );
MemoryStream noteData = (MemoryStream)FileCache.Instance.LoadFile( NoteFileName );
string noteXML = Encoding.UTF8.GetString( noteData.ToArray( ), 0, (int)noteData.Length );
noteData.Dispose( );
string styleSheetUrl = Note.GetStyleSheetUrl( noteXML, StyleSheetDefaultHostDomain );
StyleFileName = Rock.Mobile.Util.Strings.Parsers.ParseURLToFileName( styleSheetUrl );
MemoryStream styleData = (MemoryStream)FileCache.Instance.LoadFile( StyleFileName );
string styleXML = Encoding.UTF8.GetString( styleData.ToArray( ), 0, (int)styleData.Length );
styleData.Dispose( );
Note = new Note( noteXML, styleXML );
// Use the metrics and not ScrollView for dimensions, because depending on when this gets called the ScrollView
// may not have its dimensions set yet.
float scrollPercentOffset = Note.Create( NavbarFragment.GetCurrentContainerDisplayWidth( ),
this.Resources.DisplayMetrics.HeightPixels,
ScrollViewLayout,
NoteFileName + PrivateNoteConfig.UserNoteSuffix,
DisplayMessageBox,
UpdateScrollViewHeight );
// set the requested background color
ScrollView.SetBackgroundColor( ( Android.Graphics.Color )Rock.Mobile.UI.Util.GetUIColor( ControlStyles.mMainNote.mBackgroundColor.Value ) );
// update the height of the scroll view to fit all content
float noteBottom = Note.GetNoteAbsoluteHeight( );
int scrollFrameHeight = ( int )noteBottom + ( this.Resources.DisplayMetrics.HeightPixels / 3 );
ScrollViewLayout.LayoutParameters.Height = scrollFrameHeight;
// scroll to where the user left off
ScrollView.Post( new Action( delegate
{
ScrollView.ForceScrollTo( 0, (int) (scrollPercentOffset * (float)scrollFrameHeight) );
}));
FinishNotesCreation( );
// log the note they are reading.
MessageAnalytic.Instance.Trigger( MessageAnalytic.Read, NoteName );
// display the tutorial
// if the user has never seen it, show them the tutorial screen
if( TutorialDisplayed == false &&
App.Shared.Network.RockMobileUser.Instance.NoteTutorialShownCount < PrivateNoteConfig.MaxTutorialDisplayCount )
{
TutorialDisplayed = true;
App.Shared.Network.RockMobileUser.Instance.NoteTutorialShownCount = App.Shared.Network.RockMobileUser.Instance.NoteTutorialShownCount + 1;
System.IO.Stream tutorialStream = Activity.BaseContext.Assets.Open( PrivateNoteConfig.TutorialOverlayImage );
TutorialImage = Android.Graphics.BitmapFactory.DecodeStream( tutorialStream );
TutorialOverlay.SetImageBitmap( TutorialImage );
// wait a second before revealing the tutorial overlay
System.Timers.Timer timer = new System.Timers.Timer();
timer.AutoReset = false;
timer.Interval = 750;
timer.Elapsed += (object sender, System.Timers.ElapsedEventArgs e ) =>
{
Rock.Mobile.Threading.Util.PerformOnUIThread( delegate
{
TutorialBacker.Visibility = ViewStates.Visible;
AnimateTutorialScreen( true );
ScrollView.ScrollEnabled = false;
});
};
timer.Start( );
}
ParentTask.NavbarFragment.NavToolbar.Reveal( true );
}
catch( Exception ex )
{
ReportException( "", ex );
}
}
示例2: CreateNotes
protected void CreateNotes( )
{
try
{
// expect the note and its style sheet to exist.
NoteFileName = Rock.Mobile.Util.Strings.Parsers.ParseURLToFileName( NoteUrl );
MemoryStream noteData = (MemoryStream)FileCache.Instance.LoadFile( NoteFileName );
string noteXML = Encoding.UTF8.GetString( noteData.ToArray( ), 0, (int)noteData.Length );
string styleSheetUrl = Note.GetStyleSheetUrl( noteXML, StyleSheetDefaultHostDomain );
StyleFileName = Rock.Mobile.Util.Strings.Parsers.ParseURLToFileName( styleSheetUrl );
MemoryStream styleData = (MemoryStream)FileCache.Instance.LoadFile( StyleFileName );
string styleXML = Encoding.UTF8.GetString( styleData.ToArray( ), 0, (int)styleData.Length );
Note = new Note( noteXML, styleXML );
float scrollPercentOffset = Note.Create( (float)UIScrollView.Bounds.Width,
(float)UIScrollView.Bounds.Height,
this.UIScrollView,
NoteFileName + PrivateNoteConfig.UserNoteSuffix,
DisplayMessageBox,
UpdateScrollViewHeight );
// enable scrolling
UIScrollView.ScrollEnabled = true;
// take the requested background color
UIScrollView.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( ControlStyles.mMainNote.mBackgroundColor.Value );
View.BackgroundColor = UIScrollView.BackgroundColor; //Make the view itself match too
// update the height of the scroll view to fit all content
//CGRect frame = Note.GetFrame( );
float height = Note.GetNoteAbsoluteHeight( );
UIScrollView.ContentSize = new CGSize( UIScrollView.Bounds.Width, height + ( UIScrollView.Bounds.Height / 3 ) );
UIScrollView.ContentOffset = new CGPoint( 0, scrollPercentOffset * UIScrollView.ContentSize.Height );
FinishNotesCreation( );
// log the note they are reading.
MessageAnalytic.Instance.Trigger( MessageAnalytic.Read, NoteName );
// if the user has never seen it, show them the tutorial screen
if( TutorialDisplayed == false && App.Shared.Network.RockMobileUser.Instance.NoteTutorialShownCount < PrivateNoteConfig.MaxTutorialDisplayCount )
{
TutorialDisplayed = true;
App.Shared.Network.RockMobileUser.Instance.NoteTutorialShownCount = App.Shared.Network.RockMobileUser.Instance.NoteTutorialShownCount + 1;
// wait a second before revealing the tutorial overlay
System.Timers.Timer timer = new System.Timers.Timer();
timer.AutoReset = false;
timer.Interval = 750;
timer.Elapsed += (object sender, System.Timers.ElapsedEventArgs e ) =>
{
Rock.Mobile.Threading.Util.PerformOnUIThread( delegate
{
TutorialOverlay.Image = new UIImage( NSBundle.MainBundle.BundlePath + "/" + PrivateNoteConfig.TutorialOverlayImage );
TutorialOverlay.ContentMode = UIViewContentMode.Center;
TutorialOverlay.Frame = View.Frame;
TutorialBacker.Frame = View.Frame;
TutorialBacker.Hidden = false;
AnimateTutorialScreen( true );
UIScrollView.ScrollEnabled = false;
});
};
timer.Start( );
}
Task.NavToolbar.Reveal( true );
}
catch( Exception ex )
{
ReportException( "", ex );
}
}