complete
parent
6681c11444
commit
345405e7b1
|
@ -3,6 +3,8 @@ using Android.App;
|
|||
using Android.Content.PM;
|
||||
using Android.OS;
|
||||
using Android.Views;
|
||||
using MediaManager;
|
||||
using MediaManager.Forms.Platforms.Android;
|
||||
using Prism;
|
||||
using Prism.Ioc;
|
||||
using Xamarin.Forms.Platform.Android;
|
||||
|
@ -23,6 +25,9 @@ namespace iElection.Droid
|
|||
Xamarin.Forms.Forms.SetFlags(new string[] { "CarouselView_Experimental", "SwipeView_Experimental", "IndicatorView_Experimental" });
|
||||
FFImageLoading.Forms.Platform.CachedImageRenderer.Init(true);
|
||||
Rg.Plugins.Popup.Popup.Init(this);
|
||||
|
||||
CrossMediaManager.Current.Init(this);
|
||||
|
||||
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="2" android:versionName="1.1" package="com.viranasirfanavar.ielection" android:installLocation="auto">
|
||||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29" />
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:usesCleartextTraffic="True" android:versionCode="9" android:versionName="1.29" package="com.viranasirfanavar.ielection" android:installLocation="auto">
|
||||
<uses-sdk android:minSdkVersion="22" android:targetSdkVersion="29" />
|
||||
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
||||
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
|
||||
<uses-permission android:name="android.permission.MEDIA_CONTENT_CONTROL" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<application android:label="شورای شهر" android:icon="@mipmap/ic_ielection"></application>
|
||||
</manifest>
|
|
@ -68,6 +68,12 @@
|
|||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Octane.Xam.VideoPlayer">
|
||||
<Version>3.1.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Plugin.MediaManager.Forms">
|
||||
<Version>1.0.8</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Prism.Unity.Forms">
|
||||
<Version>8.0.0.1909</Version>
|
||||
</PackageReference>
|
||||
|
|
|
@ -198,6 +198,12 @@
|
|||
<Reference Include="Xamarin.iOS" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Octane.Xam.VideoPlayer">
|
||||
<Version>3.1.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Plugin.MediaManager.Forms">
|
||||
<Version>1.0.8</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Prism.Unity.Forms">
|
||||
<Version>8.0.0.1909</Version>
|
||||
</PackageReference>
|
||||
|
|
|
@ -50,6 +50,7 @@ namespace iElection
|
|||
containerRegistry.RegisterForNavigation<SignUpPage, SignUpPageViewModel>();
|
||||
|
||||
containerRegistry.RegisterForNavigation<AddContactPage, AddContactPageViewModel>();
|
||||
containerRegistry.RegisterForNavigation<TestPage, TestPageViewModel>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,5 +13,6 @@ namespace iElection.Models
|
|||
public static string NotificationController { get; } = $"{BaseController}Notification";
|
||||
public static string ContactController { get; } = $"{BaseController}Contact";
|
||||
public static string PageController { get; } = $"{BaseController}Page";
|
||||
public static string ActivityController { get; } = $"{BaseController}Activity";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,5 +7,6 @@ namespace iElection.Models.Config
|
|||
public static class Settings
|
||||
{
|
||||
public static string UserToken { get; set; } = "UserToken";
|
||||
public static string FullName { get; set; } = "FullName";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,6 @@ namespace iElection.Models.Dto
|
|||
{
|
||||
public ObservableCollection<Notification> Notifications { get; set; } = new ObservableCollection<Notification>();
|
||||
public ObservableCollection<Contact> Contacts { get; set; } = new ObservableCollection<Contact>();
|
||||
|
||||
public ObservableCollection<Activity> Activities { get; set; } = new ObservableCollection<Activity>();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace iElection.Models.Entities
|
||||
{
|
||||
public enum ActivityType
|
||||
{
|
||||
Image, Clip
|
||||
}
|
||||
|
||||
public class Activity
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string NameFile { get; set; }
|
||||
public string ImageUrl { get; set; }
|
||||
public string ClipUrl { get; set; }
|
||||
|
||||
public ActivityType ActivityType { get; set; }
|
||||
public string CreateAt { get; set; }
|
||||
}
|
||||
}
|
|
@ -54,8 +54,8 @@ namespace iElection.Services
|
|||
await UtilitiesWrapper.Instance.PopUpUtilities.PushAsync(popup);
|
||||
popup.Accepted += ((sender, e) =>
|
||||
{
|
||||
//UtilitiesWrapper.Instance.UserUtilities.Logout();
|
||||
//NavigationService.NavigateAsync("myapp:///NavigationPage/LoginPage");
|
||||
UtilitiesWrapper.Instance.UserUtilities.LogOut();
|
||||
NavigationService.NavigateAsync("myapp:///NavigationPage/LoginPage");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,29 @@ namespace iElection.Utilities
|
|||
_userToken = value;
|
||||
}
|
||||
}
|
||||
private string _fullName;
|
||||
public string FullName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_fullName == null)
|
||||
_fullName = Preferences.Get(Settings.FullName, string.Empty);
|
||||
return _fullName;
|
||||
}
|
||||
set
|
||||
{
|
||||
Preferences.Set(Settings.FullName, value);
|
||||
_fullName = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void LogOut()
|
||||
{
|
||||
_userToken = null;
|
||||
Preferences.Set(Settings.UserToken, null);
|
||||
_fullName = null;
|
||||
Preferences.Set(Settings.FullName, null);
|
||||
}
|
||||
public bool IsAuthorized
|
||||
{
|
||||
get
|
||||
|
|
|
@ -115,8 +115,7 @@ namespace iElection.ViewModels
|
|||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(PageDto.FirstName))
|
||||
throw new Exception("نام را وارد کنید");
|
||||
UtilitiesWrapper.Instance.PopUpUtilities.PushIndicator();
|
||||
if (string.IsNullOrEmpty(PageDto.LastName))
|
||||
throw new Exception("نام خانوادگی را وارد کنید");
|
||||
if (string.IsNullOrEmpty(PageDto.Phone))
|
||||
|
@ -129,6 +128,7 @@ namespace iElection.ViewModels
|
|||
.Create(PageDto, UtilitiesWrapper.Instance.UserUtilities.UserToken);
|
||||
if (rest.IsSuccess)
|
||||
{
|
||||
UtilitiesWrapper.Instance.PopUpUtilities.PopAsync();
|
||||
UtilitiesWrapper.Instance.PopUpUtilities.PushSuccess("افزودن مخاطب با موفقیت انجام شد");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ namespace iElection.ViewModels
|
|||
{
|
||||
try
|
||||
{
|
||||
UtilitiesWrapper.Instance.PopUpUtilities.PushIndicator();
|
||||
if (string.IsNullOrEmpty(PageDto.Phone))
|
||||
throw new Exception("شماره تلفن خود را وارد کنید");
|
||||
if (string.IsNullOrEmpty(PageDto.Password))
|
||||
|
@ -37,8 +38,10 @@ namespace iElection.ViewModels
|
|||
var rest = await RestWrapper.AccountApiRest.LoginUser(PageDto);
|
||||
if (rest.IsSuccess)
|
||||
{
|
||||
UtilitiesWrapper.Instance.PopUpUtilities.PopAsync();
|
||||
UtilitiesWrapper.Instance.UserUtilities.UserToken = "Bearer " + rest.Data.jwt;
|
||||
await NavigationService.NavigateAsync("MainPage");
|
||||
UtilitiesWrapper.Instance.UserUtilities.FullName = rest.Data.fullName;
|
||||
await NavigationService.NavigateAsync("myapp:///NavigationPage/MainPage");
|
||||
}
|
||||
}
|
||||
catch (ApiException e)
|
||||
|
|
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
|||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using iElection.Models;
|
||||
using iElection.Models.Dto;
|
||||
|
@ -22,8 +23,22 @@ namespace iElection.ViewModels
|
|||
public ICommand AddNewContactCommand { get; set; }
|
||||
public ICommand SelectContactCommand { get; set; }
|
||||
public ICommand SelectNotificationCommand { get; set; }
|
||||
public ICommand ContactsRefreshCommand { get; set; }
|
||||
public ICommand ActivitiesRefreshCommand { get; set; }
|
||||
public ICommand ResomeRefreshCommand { get; set; }
|
||||
public ICommand NotificationsRefreshCommand { get; set; }
|
||||
public ICommand LogOutCommand { get; set; }
|
||||
public bool IsWorking { get; set; } = false;
|
||||
public bool IsContactsRefreshing { get; set; } = false;
|
||||
private bool isContactsRefreshing = false;
|
||||
public bool IsResomeRefreshing { get; set; } = false;
|
||||
private bool isResomeRefreshing = false;
|
||||
public bool IsActivityRefreshing { get; set; } = false;
|
||||
private bool isActivityRefreshing = false;
|
||||
public bool IsNotificationRefreshing { get; set; } = false;
|
||||
private bool isNotificationRefreshing = false;
|
||||
public string Text { get; set; }
|
||||
public string FullName { get; set; }
|
||||
public ObservableCollection<string> Images { get; set; } = new ObservableCollection<string>();
|
||||
public MainPageViewModel(INavigationService navigationService , IRestWrapper restWrapper) : base(navigationService,restWrapper)
|
||||
{
|
||||
|
@ -36,34 +51,18 @@ namespace iElection.ViewModels
|
|||
{
|
||||
if (IsWorking)
|
||||
return;
|
||||
PageDto.Contacts.Clear();
|
||||
PageDto.Notifications.Clear();
|
||||
Images.Clear();
|
||||
IsWorking = true;
|
||||
|
||||
UtilitiesWrapper.Instance.PopUpUtilities.PushIndicator();
|
||||
var rest = await RestWrapper.CrudApiRest<Notification, int>(Address.NotificationController)
|
||||
.ReadAll(UtilitiesWrapper.Instance.UserUtilities.UserToken);
|
||||
if (rest.IsSuccess)
|
||||
rest.Data.ForEach(n => PageDto.Notifications.Add(n));
|
||||
var restContact = await RestWrapper.CrudApiRest<Contact, int>(Address.ContactController)
|
||||
.ReadAll(UtilitiesWrapper.Instance.UserUtilities.UserToken);
|
||||
if (restContact.IsSuccess)
|
||||
restContact.Data.ForEach(c => PageDto.Contacts.Add(c));
|
||||
var restCV = await RestWrapper.PageRestApi.GetInfoCv(UtilitiesWrapper.Instance.UserUtilities.UserToken);
|
||||
if (restCV.IsSuccess)
|
||||
{
|
||||
Text = restCV.Data.Text;
|
||||
restCV.Data.Images.ForEach(i=>Images.Add(i));
|
||||
Title = restCV.Data.Title;
|
||||
}
|
||||
await UtilitiesWrapper.Instance.PopUpUtilities.PopAsync();
|
||||
FullName = UtilitiesWrapper.Instance.UserUtilities.FullName;
|
||||
GetActivities();
|
||||
GetContacts();
|
||||
GetNotifications();
|
||||
await GetResome();
|
||||
|
||||
}
|
||||
catch (ApiException e)
|
||||
{
|
||||
await UtilitiesWrapper.Instance.PopUpUtilities.PopAsync();
|
||||
RestWrapper.UnhandledExceptionRaiser(e);
|
||||
RestWrapper.UnhandledExceptionRaiser(e,NavigationService);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -76,9 +75,136 @@ namespace iElection.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
public async Task GetActivities()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (isActivityRefreshing)
|
||||
return;
|
||||
PageDto.Activities.Clear();
|
||||
isActivityRefreshing = true;
|
||||
var restActive = await RestWrapper.CrudApiRest<Activity, int>(Address.ActivityController)
|
||||
.ReadAll(UtilitiesWrapper.Instance.UserUtilities.UserToken);
|
||||
if (restActive.IsSuccess)
|
||||
{
|
||||
restActive.Data.ForEach(a => PageDto.Activities.Add(a));
|
||||
}
|
||||
|
||||
}
|
||||
catch (ApiException e)
|
||||
{
|
||||
await UtilitiesWrapper.Instance.PopUpUtilities.PopAsync();
|
||||
RestWrapper.UnhandledExceptionRaiser(e, NavigationService);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
await UtilitiesWrapper.Instance.PopUpUtilities.PopAsync();
|
||||
UtilitiesWrapper.Instance.PopUpUtilities.PushError(e.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
isActivityRefreshing = false;
|
||||
IsActivityRefreshing = false;
|
||||
}
|
||||
}
|
||||
public async Task GetResome()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (isResomeRefreshing)
|
||||
return;
|
||||
Images.Clear();
|
||||
isResomeRefreshing = true;
|
||||
var restCV = await RestWrapper.PageRestApi.GetInfoCv(UtilitiesWrapper.Instance.UserUtilities.UserToken);
|
||||
if (restCV.IsSuccess)
|
||||
{
|
||||
Text = restCV.Data.Text;
|
||||
restCV.Data.Images.ForEach(i => Images.Add(i));
|
||||
Title = restCV.Data.Title;
|
||||
}
|
||||
|
||||
}
|
||||
catch (ApiException e)
|
||||
{
|
||||
await UtilitiesWrapper.Instance.PopUpUtilities.PopAsync();
|
||||
RestWrapper.UnhandledExceptionRaiser(e, NavigationService);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
await UtilitiesWrapper.Instance.PopUpUtilities.PopAsync();
|
||||
UtilitiesWrapper.Instance.PopUpUtilities.PushError(e.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsResomeRefreshing = false;
|
||||
isResomeRefreshing = false;
|
||||
}
|
||||
}
|
||||
public async Task GetNotifications()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (isNotificationRefreshing)
|
||||
return;
|
||||
PageDto.Notifications.Clear();
|
||||
isNotificationRefreshing = true;
|
||||
var rest = await RestWrapper.CrudApiRest<Notification, int>(Address.NotificationController)
|
||||
.ReadAll(UtilitiesWrapper.Instance.UserUtilities.UserToken);
|
||||
if (rest.IsSuccess)
|
||||
rest.Data.ForEach(n => PageDto.Notifications.Add(n));
|
||||
|
||||
}
|
||||
catch (ApiException e)
|
||||
{
|
||||
await UtilitiesWrapper.Instance.PopUpUtilities.PopAsync();
|
||||
RestWrapper.UnhandledExceptionRaiser(e, NavigationService);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
await UtilitiesWrapper.Instance.PopUpUtilities.PopAsync();
|
||||
UtilitiesWrapper.Instance.PopUpUtilities.PushError(e.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
isNotificationRefreshing = false;
|
||||
IsNotificationRefreshing = false;
|
||||
}
|
||||
}
|
||||
public async Task GetContacts()
|
||||
{
|
||||
try
|
||||
{
|
||||
if(isContactsRefreshing)
|
||||
return;
|
||||
PageDto.Contacts.Clear();
|
||||
isContactsRefreshing = true;
|
||||
var restContact = await RestWrapper.CrudApiRest<Contact, int>(Address.ContactController)
|
||||
.ReadAll(UtilitiesWrapper.Instance.UserUtilities.UserToken);
|
||||
if (restContact.IsSuccess)
|
||||
restContact.Data.ForEach(c => PageDto.Contacts.Add(c));
|
||||
|
||||
}
|
||||
catch (ApiException e)
|
||||
{
|
||||
await UtilitiesWrapper.Instance.PopUpUtilities.PopAsync();
|
||||
RestWrapper.UnhandledExceptionRaiser(e, NavigationService);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
await UtilitiesWrapper.Instance.PopUpUtilities.PopAsync();
|
||||
UtilitiesWrapper.Instance.PopUpUtilities.PushError(e.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
isContactsRefreshing = false;
|
||||
IsContactsRefreshing = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void InitializeCommand()
|
||||
{
|
||||
base.InitializeCommand();
|
||||
|
||||
AddNewContactCommand = new DelegateCommand(() =>
|
||||
{
|
||||
NavigationService.NavigateAsync("AddContactPage");
|
||||
|
@ -109,7 +235,7 @@ namespace iElection.ViewModels
|
|||
}
|
||||
catch (ApiException e)
|
||||
{
|
||||
RestWrapper.UnhandledExceptionRaiser(e);
|
||||
RestWrapper.UnhandledExceptionRaiser(e, NavigationService);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -131,7 +257,7 @@ namespace iElection.ViewModels
|
|||
}
|
||||
catch (ApiException e)
|
||||
{
|
||||
RestWrapper.UnhandledExceptionRaiser(e);
|
||||
RestWrapper.UnhandledExceptionRaiser(e, NavigationService);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -139,6 +265,15 @@ namespace iElection.ViewModels
|
|||
}
|
||||
|
||||
});
|
||||
ContactsRefreshCommand = new DelegateCommand(async () => await GetContacts());
|
||||
NotificationsRefreshCommand = new DelegateCommand(async () => await GetNotifications());
|
||||
ActivitiesRefreshCommand = new DelegateCommand(async () => await GetActivities());
|
||||
ResomeRefreshCommand = new DelegateCommand(async () => await GetResome());
|
||||
LogOutCommand = new DelegateCommand(async () =>
|
||||
{
|
||||
UtilitiesWrapper.Instance.UserUtilities.LogOut();
|
||||
await NavigationService.NavigateAsync("myapp:///NavigationPage/LoginPage");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace iElection.ViewModels
|
|||
public RegisterInfoDto InfoDto { get; set; } = new RegisterInfoDto();
|
||||
public ICommand SignUpCommand { get; set; }
|
||||
public ICommand LoginCommand { get; set; }
|
||||
public SignUpPageViewModel(INavigationService navigationService , IRestWrapper restWrapper):base(navigationService,restWrapper)
|
||||
public SignUpPageViewModel(INavigationService navigationService, IRestWrapper restWrapper) : base(navigationService, restWrapper)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -94,7 +94,8 @@ namespace iElection.ViewModels
|
|||
{
|
||||
|
||||
UtilitiesWrapper.Instance.UserUtilities.UserToken = "Bearer " + rest.Data.jwt;
|
||||
await NavigationService.NavigateAsync("MainPage");
|
||||
UtilitiesWrapper.Instance.UserUtilities.FullName = rest.Data.fullName;
|
||||
await NavigationService.NavigateAsync("myapp:///NavigationPage/MainPage");
|
||||
UtilitiesWrapper.Instance.PopUpUtilities.PushSuccess("ثبت نام با موفقیت انجام شد");
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
using Prism.Commands;
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace iElection.ViewModels
|
||||
{
|
||||
public class TestPageViewModel : BindableBase
|
||||
{
|
||||
public TestPageViewModel()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<ContentView
|
||||
x:Class="iElection.Views.Controllers.PostItemTemplate"
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:forms="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
|
||||
xmlns:models="clr-namespace:iElection.Models;assembly=iElection"
|
||||
xmlns:videoPlayer="clr-namespace:Octane.Xamarin.Forms.VideoPlayer;assembly=Octane.Xamarin.Forms.VideoPlayer"
|
||||
xmlns:views="http://xamarin.com/schemas/2020/toolkit">
|
||||
<ContentView.Content>
|
||||
<StackLayout>
|
||||
<Frame
|
||||
Margin="10,5"
|
||||
Padding="0"
|
||||
CornerRadius="7">
|
||||
<StackLayout Margin="8">
|
||||
<Grid>
|
||||
<forms:CachedImage
|
||||
Margin="-8"
|
||||
Aspect="AspectFill"
|
||||
Source="{Binding ImageUrl}" />
|
||||
<Frame
|
||||
x:Name="clipButton"
|
||||
Padding="0"
|
||||
BackgroundColor="{StaticResource Stylish}"
|
||||
CornerRadius="25"
|
||||
HorizontalOptions="End"
|
||||
VerticalOptions="End">
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Label
|
||||
FontFamily="{StaticResource MaterialFontFamily}"
|
||||
FontSize="30"
|
||||
Text="{x:Static models:MaterialIconFont.PlayCircle}"
|
||||
TextColor="White" />
|
||||
<Label
|
||||
Margin="15,0,0,5"
|
||||
HorizontalOptions="Center"
|
||||
Text="نمایش ویدیو"
|
||||
TextColor="White"
|
||||
VerticalOptions="Center" />
|
||||
</StackLayout>
|
||||
<Frame.GestureRecognizers>
|
||||
<TapGestureRecognizer Tapped="PlayVideo_OnTapped" />
|
||||
</Frame.GestureRecognizers>
|
||||
</Frame>
|
||||
</Grid>
|
||||
<Label
|
||||
Margin="0,8,0,0"
|
||||
HorizontalOptions="Start"
|
||||
Text="{Binding CreateAt}"
|
||||
TextColor="#777" />
|
||||
<Label
|
||||
Margin="0,-8"
|
||||
FontSize="Medium"
|
||||
Text="{Binding Title}"
|
||||
TextColor="#222" />
|
||||
<Label
|
||||
LineBreakMode="WordWrap"
|
||||
Text="{Binding Description}"
|
||||
TextColor="#222" />
|
||||
</StackLayout>
|
||||
</Frame>
|
||||
</StackLayout>
|
||||
</ContentView.Content>
|
||||
</ContentView>
|
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using iElection.Models.Entities;
|
||||
using Xamarin.Essentials;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Xaml;
|
||||
|
||||
namespace iElection.Views.Controllers
|
||||
{
|
||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
public partial class PostItemTemplate : ContentView
|
||||
{
|
||||
public PostItemTemplate()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnBindingContextChanged()
|
||||
{
|
||||
base.OnBindingContextChanged();
|
||||
if (BindingContext is Activity activity)
|
||||
{
|
||||
if (activity.ActivityType == ActivityType.Clip)
|
||||
clipButton.IsVisible = true;
|
||||
else
|
||||
clipButton.IsVisible = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void PlayVideo_OnTapped(object sender, EventArgs e)
|
||||
{
|
||||
Launcher.OpenAsync((BindingContext as Activity).ClipUrl);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -41,7 +41,7 @@
|
|||
MaterialTheme="Acrylic">
|
||||
<Entry
|
||||
FontSize="Small"
|
||||
Placeholder="نام کاربری"
|
||||
Placeholder="شماره تلفن"
|
||||
Text="{Binding Path=PageDto.Phone, Mode=TwoWay}" />
|
||||
</materialFrame:MaterialFrame>
|
||||
<materialFrame:MaterialFrame
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
x:Class="iElection.Views.MainPage"
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:controllers="clr-namespace:iElection.Views.Controllers;assembly=iElection"
|
||||
xmlns:forms="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
|
||||
xmlns:materialFrame="http://sharpnado.com"
|
||||
xmlns:models="clr-namespace:iElection.Models;assembly=iElection"
|
||||
|
@ -11,16 +12,55 @@
|
|||
BackgroundColor="{StaticResource Gray-200}"
|
||||
NavigationPage.HasNavigationBar="False">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Frame
|
||||
Margin="0,-25,0,0"
|
||||
Padding="10,35,10,10"
|
||||
BackgroundColor="{StaticResource PrimaryColor}"
|
||||
CornerRadius="15"
|
||||
FlowDirection="RightToLeft">
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<Label
|
||||
Margin="10,0"
|
||||
FontFamily="{StaticResource ShabnameBold}"
|
||||
HorizontalOptions="Start"
|
||||
Text="{Binding FullName}"
|
||||
TextColor="White"
|
||||
VerticalOptions="Center" />
|
||||
<Button
|
||||
Grid.Column="1"
|
||||
Padding="0"
|
||||
BackgroundColor="{StaticResource PrimaryLighterColor}"
|
||||
Command="{Binding LogOutCommand}"
|
||||
CornerRadius="15"
|
||||
HeightRequest="35"
|
||||
Text="خروج"
|
||||
TextColor="White" />
|
||||
|
||||
</Grid>
|
||||
</Frame>
|
||||
<views:TabView
|
||||
Grid.Row="1"
|
||||
TabIndicatorColor="{StaticResource Blue}"
|
||||
TabStripBackgroundColor="White"
|
||||
TabStripHeight="60"
|
||||
TabStripPlacement="Bottom">
|
||||
|
||||
<views:TabViewItem FontFamily="{StaticResource ShabnameBold}" Text="مخاطبین">
|
||||
<Grid>
|
||||
|
||||
<RefreshView
|
||||
Command="{Binding ContactsRefreshCommand}"
|
||||
IsRefreshing="{Binding IsContactsRefreshing}"
|
||||
RefreshColor="{StaticResource PrimaryColor}">
|
||||
<RefreshView.Content>
|
||||
|
||||
<Grid FlowDirection="RightToLeft">
|
||||
|
||||
|
||||
<CollectionView ItemsSource="{Binding PageDto.Contacts}">
|
||||
<CollectionView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
|
@ -87,9 +127,18 @@
|
|||
</materialFrame:MaterialFrame.GestureRecognizers>
|
||||
</materialFrame:MaterialFrame>
|
||||
</Grid>
|
||||
</RefreshView.Content>
|
||||
</RefreshView>
|
||||
</Grid>
|
||||
</views:TabViewItem>
|
||||
|
||||
<views:TabViewItem FontFamily="{StaticResource ShabnameBold}" Text="رزومه">
|
||||
<Grid>
|
||||
<RefreshView
|
||||
Command="{Binding ResomeRefreshCommand}"
|
||||
IsRefreshing="{Binding IsResomeRefreshing}"
|
||||
RefreshColor="{StaticResource PrimaryColor}">
|
||||
<RefreshView.Content>
|
||||
<Grid FlowDirection="RightToLeft" RowDefinitions="4*,Auto,8*">
|
||||
|
||||
<Frame
|
||||
|
@ -139,9 +188,40 @@
|
|||
</ScrollView>
|
||||
</materialFrame:MaterialFrame>
|
||||
</Grid>
|
||||
</RefreshView.Content>
|
||||
</RefreshView>
|
||||
</Grid>
|
||||
</views:TabViewItem>
|
||||
|
||||
<views:TabViewItem FontFamily="{StaticResource ShabnameBold}" Text="فعالیتـ ها">
|
||||
<Grid>
|
||||
<RefreshView
|
||||
Command="{Binding ActivitiesRefreshCommand}"
|
||||
IsRefreshing="{Binding IsActivityRefreshing}"
|
||||
RefreshColor="{StaticResource PrimaryColor}">
|
||||
<Grid FlowDirection="RightToLeft">
|
||||
|
||||
<CollectionView ItemsSource="{Binding PageDto.Activities}">
|
||||
<CollectionView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<controllers:PostItemTemplate />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</CollectionView.ItemTemplate>
|
||||
</CollectionView>
|
||||
|
||||
</Grid>
|
||||
</RefreshView>
|
||||
</Grid>
|
||||
</views:TabViewItem>
|
||||
|
||||
<views:TabViewItem FontFamily="{StaticResource ShabnameBold}" Text="اطلاعیه">
|
||||
<Grid>
|
||||
<RefreshView
|
||||
Command="{Binding NotificationsRefreshCommand}"
|
||||
IsRefreshing="{Binding IsNotificationRefreshing}"
|
||||
RefreshColor="{StaticResource PrimaryColor}">
|
||||
<Grid FlowDirection="RightToLeft">
|
||||
|
||||
<CollectionView ItemsSource="{Binding PageDto.Notifications}">
|
||||
|
@ -191,33 +271,12 @@
|
|||
</DataTemplate>
|
||||
</CollectionView.ItemTemplate>
|
||||
</CollectionView>
|
||||
<!--<materialFrame:MaterialFrame
|
||||
Margin="10,15"
|
||||
Padding="0"
|
||||
AcrylicGlowColor="#3498db"
|
||||
CornerRadius="18"
|
||||
HorizontalOptions="Start"
|
||||
LightThemeBackgroundColor="#2980b9"
|
||||
MaterialTheme="Acrylic"
|
||||
VerticalOptions="End">
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Label
|
||||
FontFamily="{StaticResource MaterialFontFamily}"
|
||||
FontSize="40"
|
||||
Text="{x:Static models:MaterialIconFont.PlusCircle}"
|
||||
TextColor="White" />
|
||||
<Label
|
||||
Margin="15,0,0,3"
|
||||
FontFamily="{StaticResource ShabnameBold}"
|
||||
Text="افزودن اطلاعیه"
|
||||
TextColor="White"
|
||||
VerticalOptions="Center" />
|
||||
</StackLayout>
|
||||
<materialFrame:MaterialFrame.GestureRecognizers>
|
||||
<TapGestureRecognizer Tapped="AddNewContact_OnTapped" />
|
||||
</materialFrame:MaterialFrame.GestureRecognizers>
|
||||
</materialFrame:MaterialFrame>-->
|
||||
</Grid>
|
||||
</RefreshView>
|
||||
</Grid>
|
||||
</views:TabViewItem>
|
||||
|
||||
|
||||
</views:TabView>
|
||||
</Grid>
|
||||
</ContentPage>
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage
|
||||
x:Class="iElection.Views.TestPage"
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:forms="clr-namespace:MediaManager.Forms;assembly=MediaManager.Forms"
|
||||
xmlns:prism="http://prismlibrary.com"
|
||||
xmlns:videoPlayer="clr-namespace:Octane.Xamarin.Forms.VideoPlayer;assembly=Octane.Xamarin.Forms.VideoPlayer"
|
||||
xmlns:views="http://xamarin.com/schemas/2020/toolkit"
|
||||
prism:ViewModelLocator.AutowireViewModel="True">
|
||||
<StackLayout>
|
||||
|
||||
<Frame x:Name="browserFrame" Padding="0" />
|
||||
<forms:VideoView
|
||||
x:Name="video"
|
||||
AutoPlay="False"
|
||||
HeightRequest="300"
|
||||
ShowControls="True"
|
||||
Source="http://94.183.8.213/api/v1/Download/ActivityClip/20"
|
||||
WidthRequest="250" />
|
||||
<Button Clicked="Button_OnClicked" Text="play" />
|
||||
</StackLayout>
|
||||
</ContentPage>
|
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
using MediaManager;
|
||||
using Xamarin.CommunityToolkit.Core;
|
||||
using Xamarin.Essentials;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace iElection.Views
|
||||
{
|
||||
public partial class TestPage : ContentPage
|
||||
{
|
||||
public TestPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
string htmlText = @"<video controls><source src=""http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"" type=""video/mp4""></video>";
|
||||
var browser = new WebView();
|
||||
browser.HeightRequest = 500;
|
||||
browser.WidthRequest = 200;
|
||||
var html = new HtmlWebViewSource
|
||||
{
|
||||
Html = htmlText
|
||||
};
|
||||
browser.Source = html;
|
||||
browserFrame.Content = browser;
|
||||
}
|
||||
|
||||
private void Button_OnClicked(object sender, EventArgs e)
|
||||
{
|
||||
Permissions.RequestAsync<Permissions.StorageRead>();
|
||||
Permissions.RequestAsync<Permissions.StorageWrite>();
|
||||
Permissions.RequestAsync<Permissions.Media>();
|
||||
}
|
||||
|
||||
private void MediaElement_OnSeekCompleted(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void MediaElement_OnMediaFailed(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,9 +10,8 @@
|
|||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Color x:Key="PrimaryColor">#182339</Color>
|
||||
<Color x:Key="PrimaryDarkColor">#6044AE</Color>
|
||||
<Color x:Key="PrimaryDarkenColor">#432E7D</Color>
|
||||
<Color x:Key="PrimaryLighterColor">#A98BFF</Color>
|
||||
<Color x:Key="PrimaryDarkColor">#0c1424</Color>
|
||||
<Color x:Key="PrimaryLighterColor">#37486b</Color>
|
||||
<Color x:Key="PrimaryLight">#B6C2E2</Color>
|
||||
|
||||
<Color x:Key="PrimaryGradient">#e83f94</Color>
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Octane.Xam.VideoPlayer" Version="3.1.0" />
|
||||
<PackageReference Include="Plugin.MediaManager.Forms" Version="1.0.8" />
|
||||
<PackageReference Include="Prism.Unity.Forms" Version="8.0.0.1909" />
|
||||
<PackageReference Include="PropertyChanged.Fody" Version="3.3.3" />
|
||||
<PackageReference Include="Refit" Version="6.0.38" />
|
||||
|
@ -31,6 +33,9 @@
|
|||
<EmbeddedResource Update="Views\AddContactPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Views\Controllers\PostItemTemplate.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Views\LoginPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
|
@ -52,6 +57,9 @@
|
|||
<EmbeddedResource Update="Views\SignUpPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Views\TestPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Views\Themes\BaseTheme.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
|
@ -60,10 +68,6 @@
|
|||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Views\Controllers\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="AppResource.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
|
|
Loading…
Reference in New Issue