Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
2
2018-app-inutralia
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
inutralia
2018-app-inutralia
Commits
f36025c2
Commit
f36025c2
authored
Feb 05, 2019
by
Javier Piris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modificado NewQuestionViewModel y la vista
parent
b1ed00b5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
6 deletions
+85
-6
NewQuestionViewModel.cs
...ia/ViewModels/QuestionsSpecialist/NewQuestionViewModel.cs
+8
-5
NewConsultationView.xaml.cs
...alia/inutralia/Views/Question/NewConsultationView.xaml.cs
+77
-1
No files found.
inutralia/inutralia/ViewModels/QuestionsSpecialist/NewQuestionViewModel.cs
View file @
f36025c2
...
...
@@ -6,7 +6,7 @@ using System.Net.Http;
using
System.Threading.Tasks
;
using
Xamarin.Forms
;
namespace
inutralia.ViewModels
.QuestionsSpecialist
namespace
inutralia.ViewModels
{
public
class
NewQuestionViewModel
:
BaseNavigationViewModel
{
...
...
@@ -71,7 +71,7 @@ namespace inutralia.ViewModels.QuestionsSpecialist
if
(
await
App
.
API
.
RefreshItemAsync
(
QuestionSpecialist
))
{
Title
=
QuestionSpecialist
.
StatusImg
;
OnPropertyChanged
(
"Stat
us
"
);
OnPropertyChanged
(
"Stat
e
"
);
}
IsBusy
=
false
;
...
...
@@ -86,7 +86,7 @@ namespace inutralia.ViewModels.QuestionsSpecialist
{
///Realiza el procesp de actualización si hay menos
///de un elemento en el listado
//
if (QuestionSpecialist.Messages.Count() < 1)
if
(
QuestionSpecialist
.
Messages
.
Count
()
<
1
)
await
FetchQuestions
();
}
...
...
@@ -102,7 +102,7 @@ namespace inutralia.ViewModels.QuestionsSpecialist
/// <summary>
/// Proceso de ejecución del comando de actualización del listado
/// </summary>
async
Task
ExecuteRefreshQuestionMessagesCommand
()
public
async
Task
ExecuteRefreshQuestionMessagesCommand
()
{
try
{
...
...
@@ -142,6 +142,9 @@ namespace inutralia.ViewModels.QuestionsSpecialist
string
err
=
e
.
Message
;
NewQuestion
.
Clear
();
}
// Indicamos que ya no estámos ocupados (provoca que desaparezca el indicador de carga)
IsBusy
=
false
;
}
///<summary>
...
...
@@ -205,7 +208,7 @@ namespace inutralia.ViewModels.QuestionsSpecialist
else
{
QuestionMessage
msg
;
if
(
q
.
State
==
QuestionSpecialist
.
Estatus
.
Pending
)
if
(
q
.
State
==
QuestionSpecialist
.
Estatus
.
Closed
)
{
//Edit last Message
msg
=
q
.
Messages
.
Last
();
...
...
inutralia/inutralia/Views/Question/NewConsultationView.xaml.cs
View file @
f36025c2
using
Xamarin.Forms
;
using
System
;
using
System.Linq
;
using
inutralia.Models
;
using
inutralia.ViewModels
;
using
Xamarin.Forms
;
using
Xamarin.Forms.Xaml
;
namespace
inutralia.Views.Question
...
...
@@ -6,9 +10,80 @@ namespace inutralia.Views.Question
[
XamlCompilation
(
XamlCompilationOptions
.
Compile
)]
public
partial
class
NewConsultationView
:
ContentPage
{
protected
NewQuestionViewModel
ViewModel
=>
BindingContext
as
NewQuestionViewModel
;
public
NewConsultationView
()
{
InitializeComponent
();
newQuest
.
IsEnabled
=
true
;
buttonNewQuestion
.
IsEnabled
=
false
;
buttonNewQuestion
.
Clicked
+=
ButtonNewQuestion_Clicked
;
}
//protected override void OnBindingContextChanged()
//{
// base.OnBindingContextChanged();
// ViewModel.PropertyChanged += ViewModel_PropertyChanged;
//}
//private void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
//{
// OnDataRefreshed();
//}
private
async
void
ButtonNewQuestion_Clicked
(
object
sender
,
EventArgs
e
)
{
if
(
String
.
IsNullOrWhiteSpace
(
newQuest
.
Text
))
{
newQuest
.
Text
=
""
;
return
;
}
await
ViewModel
.
SaveQuestion
(
newQuest
.
Text
);
listNewConsultation
.
SelectedItem
=
null
;
//OnDataRefreshed();
}
///// <summary>
///// Método llamado cada vez que una página pasa a ser visible
///// </summary>
protected
override
async
void
OnAppearing
()
{
base
.
OnAppearing
();
//await ViewModel.RefreshData();
//OnDataRefreshed();
}
///// <summary>
///// Método llamado al hacer tap en un elemento de la lista. Navega a la página de detalle
///// de la notificación seleccionada
///// </summary>
///// <param name="sender">La ListiView</param>
///// <param name="e">Argumentos del evento</param>
void
ItemTapped
(
object
sender
,
ItemTappedEventArgs
e
)
{
if
(
e
==
null
)
return
;
// has been set to null, do not 'process' tapped event
QuestionMessage
item
=
(
QuestionMessage
)
e
.
Item
;
if
(
ViewModel
.
NewQuestion
.
Last
()
==
item
&&
item
.
FromUser
)
{
buttonNewQuestion
.
IsEnabled
=
true
;
newQuest
.
IsEnabled
=
true
;
newQuest
.
Text
=
item
.
Text
;
}
else
{
((
ListView
)
sender
).
SelectedItem
=
null
;
// de-select the row
}
}
//private void OnDataRefreshed()
//{
// newQuest.Text = "";
// newQuest.IsEnabled = !(ViewModel.IsCloseOrPending);
// newQuest.Placeholder = (ViewModel.IsCloseOrPending) ? ((ViewModel.QuestionSpecialist.State == QuestionSpecialist.Estatus.Closed) ? "La pregunta está cerrada" : "Esperando respuesta") : "Realiza una pregunta";
// buttonNewQuestion.IsEnabled = !(ViewModel.IsCloseOrPending);
//}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment