1212
1313namespace CodeHub . iOS . Views . Issues
1414{
15- public class IssueView : ViewModelDrivenDialogViewController
15+ public class IssueView : ViewModelDrivenDialogViewController
1616 {
17- protected readonly HeaderView _header ;
17+ protected HeaderView _header ;
1818 protected WebElement _descriptionElement ;
19- protected WebElement2 _commentsElement ;
19+ protected WebElement _commentsElement ;
2020 protected StyledStringElement _milestoneElement ;
2121 protected StyledStringElement _assigneeElement ;
2222 protected StyledStringElement _labelsElement ;
@@ -30,21 +30,24 @@ public class IssueView : ViewModelDrivenDialogViewController
3030
3131 public IssueView ( )
3232 {
33- Root . UnevenRows = true ;
34- _header = new HeaderView ( ) ;
33+ Root . UnevenRows = true ;
3534 }
3635
3736 public override void ViewDidLoad ( )
3837 {
3938 base . ViewDidLoad ( ) ;
4039
41- var content = System . IO . File . ReadAllText ( "WebCell/body.html" , System . Text . Encoding . UTF8 ) ;
42- _descriptionElement = new WebElement ( content ) ;
43- _descriptionElement . UrlRequested = ViewModel . GoToUrlCommand . Execute ;
40+ _header = new HeaderView ( ) ;
4441
45- var content2 = System . IO . File . ReadAllText ( "WebCell/comments.html" , System . Text . Encoding . UTF8 ) ;
46- _commentsElement = new WebElement2 ( content2 ) ;
47- _commentsElement . UrlRequested = ViewModel . GoToUrlCommand . Execute ;
42+ var content = System . IO . File . ReadAllText ( "WebCell/body.html" , System . Text . Encoding . UTF8 ) ;
43+ _descriptionElement = new WebElement ( content , "body" , false ) ;
44+ _descriptionElement . UrlRequested = ViewModel . GoToUrlCommand . Execute ;
45+ //_descriptionElement.HeightChanged = x => Render();
46+
47+ var content2 = System . IO . File . ReadAllText ( "WebCell/comments.html" , System . Text . Encoding . UTF8 ) ;
48+ _commentsElement = new WebElement ( content2 , "comments" , true ) ;
49+ _commentsElement . UrlRequested = ViewModel . GoToUrlCommand . Execute ;
50+ //_commentsElement.HeightChanged = x => Render();
4851
4952 _milestoneElement = new StyledStringElement ( "Milestone" , "No Milestone" , UITableViewCellStyle . Value1 ) { Image = Images . Milestone , Accessory = UITableViewCellAccessory . DisclosureIndicator } ;
5053 _milestoneElement . Tapped += ( ) => ViewModel . GoToMilestoneCommand . Execute ( null ) ;
@@ -58,7 +61,7 @@ public override void ViewDidLoad()
5861 _addCommentElement = new StyledStringElement ( "Add Comment" ) { Image = Images . Pencil } ;
5962 _addCommentElement . Tapped += AddCommentTapped ;
6063
61- NavigationItem . RightBarButtonItem = new UIBarButtonItem ( UIBarButtonSystemItem . Compose , ( s , e ) => ViewModel . GoToEditCommand . Execute ( null ) ) ;
64+ NavigationItem . RightBarButtonItem = new UIBarButtonItem ( UIBarButtonSystemItem . Compose , ( s , e ) => ViewModel . GoToEditCommand . Execute ( null ) ) ;
6265 NavigationItem . RightBarButtonItem . Enabled = false ;
6366 ViewModel . Bind ( x => x . IsLoading , x =>
6467 {
@@ -141,11 +144,11 @@ public void RenderComments()
141144 } ) ;
142145 var data = s . Serialize ( comments ) ;
143146
144- InvokeOnMainThread ( ( ) => {
147+ InvokeOnMainThread ( ( ) => {
145148 _commentsElement . Value = ! comments . Any ( ) ? string . Empty : data ;
146- if ( _commentsElement . GetImmediateRootElement ( ) == null )
149+ if ( _commentsElement . GetImmediateRootElement ( ) == null )
147150 Render ( ) ;
148- } ) ;
151+ } ) ;
149152 }
150153
151154 protected virtual void Render ( )
@@ -155,19 +158,19 @@ protected virtual void Render()
155158 return ;
156159
157160 var root = new RootElement ( Title ) ;
158- root . Add ( new Section ( _header ) ) ;
161+ root . Add ( new Section ( _header ) ) ;
159162
160- var secDetails = new Section ( ) ;
163+ var secDetails = new Section ( ) ;
161164 if ( ! string . IsNullOrEmpty ( _descriptionElement . Value ) )
162165 secDetails . Add ( _descriptionElement ) ;
163166
164167 secDetails . Add ( _assigneeElement ) ;
165168 secDetails . Add ( _milestoneElement ) ;
166169 secDetails . Add ( _labelsElement ) ;
167- root . Add ( secDetails ) ;
170+ root . Add ( secDetails ) ;
168171
169172 if ( ! string . IsNullOrEmpty ( _commentsElement . Value ) )
170- root . Add ( new Section { _commentsElement } ) ;
173+ root . Add ( new Section { _commentsElement } ) ;
171174
172175 root . Add ( new Section { _addCommentElement } ) ;
173176 Root = root ;
@@ -176,21 +179,21 @@ protected virtual void Render()
176179 void AddCommentTapped ( )
177180 {
178181 var composer = new MarkdownComposerViewController ( ) ;
179- composer . NewComment ( this , async ( text ) => {
180- try
181- {
182- await composer . DoWorkAsync ( "Commenting..." . t ( ) , ( ) => ViewModel . AddComment ( text ) ) ;
183- composer . CloseComposer ( ) ;
184- }
185- catch ( Exception e )
186- {
187- MonoTouch . Utilities . ShowAlert ( "Unable to post comment!" , e . Message ) ;
188- }
189- finally
190- {
191- composer . EnableSendButton = true ;
192- }
193- } ) ;
182+ composer . NewComment ( this , async ( text ) => {
183+ try
184+ {
185+ await composer . DoWorkAsync ( "Commenting..." . t ( ) , ( ) => ViewModel . AddComment ( text ) ) ;
186+ composer . CloseComposer ( ) ;
187+ }
188+ catch ( Exception e )
189+ {
190+ MonoTouch . Utilities . ShowAlert ( "Unable to post comment!" , e . Message ) ;
191+ }
192+ finally
193+ {
194+ composer . EnableSendButton = true ;
195+ }
196+ } ) ;
194197 }
195198
196199 public override UIView InputAccessoryView
0 commit comments