Skip to content

Commit

Permalink
Merge pull request #12 from ankeshdave/dev-current
Browse files Browse the repository at this point in the history
Dev current [ci skip]
  • Loading branch information
akankshagaur committed May 29, 2015
2 parents fc38745 + eb3a269 commit 5c0d97a
Show file tree
Hide file tree
Showing 23 changed files with 411 additions and 283 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
using System.Threading.Tasks;
using System.Waf.Applications;
using CalendarSyncPlus.Application.Views;
using CalendarSyncPlus.Common.Log;
using CalendarSyncPlus.Domain.Models;
using CalendarSyncPlus.Services.Interfaces;

namespace CalendarSyncPlus.Application.ViewModels
{
[Export]
public class AboutViewModel : ViewModel<IAboutView>
{
public ApplicationLogger ApplicationLogger { get; set; }
private readonly IApplicationUpdateService _applicationUpdateService;
private DelegateCommand _checkForUpdatesCommand;
private DelegateCommand _downloadCommand;
Expand All @@ -22,9 +25,11 @@ public class AboutViewModel : ViewModel<IAboutView>
private DelegateCommand _mailToCommand;

[ImportingConstructor]
public AboutViewModel(IAboutView aboutView, IApplicationUpdateService applicationUpdateService)
public AboutViewModel(IAboutView aboutView, IApplicationUpdateService applicationUpdateService,
ApplicationLogger applicationLogger)
: base(aboutView)
{
ApplicationLogger = applicationLogger;
_applicationUpdateService = applicationUpdateService;
ProductVersion = ApplicationInfo.Version;
}
Expand Down Expand Up @@ -87,12 +92,19 @@ public string UpdateText

private void DownloadNewVersion()
{
Process.Start(new ProcessStartInfo(_applicationUpdateService.GetDownloadUri().AbsoluteUri));
try
{
Process.Start(new ProcessStartInfo(_applicationUpdateService.GetDownloadUri().AbsoluteUri));
}
catch (Exception exception)
{
ApplicationLogger.LogError(exception);
}
}

private void CheckForUpdates()
{
if (IsCheckInProgress || IsLatestVersionAvailable)
if (IsCheckInProgress)
{
return;
}
Expand All @@ -101,7 +113,7 @@ private void CheckForUpdates()
IsLatestVersionAvailable = false;
UpdateText = string.Empty;
TaskScheduler scheduler = TaskScheduler.FromCurrentSynchronizationContext();
Task<string>.Factory.StartNew(() => _applicationUpdateService.GetLatestReleaseFromServer())
Task<string>.Factory.StartNew(() => _applicationUpdateService.GetLatestReleaseFromServer(true))
.ContinueWith(CheckForUpdatesComplete, scheduler);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public SettingsViewModel(ISettingsView view,
private bool _allowManualGoogleAuth;
private string _googleAuthCode;
private bool _isAuthCodeAvailable;
private bool _checkForAlphaReleases;

#endregion

Expand Down Expand Up @@ -186,11 +187,23 @@ public bool IsLoading
set { SetProperty(ref _isLoading, value); }
}

public bool CheckForAlphaReleases
{
get { return _checkForAlphaReleases; }
set { SetProperty(ref _checkForAlphaReleases, value); }
}

public bool CheckForUpdates
{
get { return _checkForUpdates; }
set { SetProperty(ref _checkForUpdates, value); }
set
{
SetProperty(ref _checkForUpdates, value);
if (!_checkForUpdates)
{
CheckForAlphaReleases = false;
}
}
}

public bool RunApplicationAtSystemStartup
Expand Down Expand Up @@ -327,7 +340,7 @@ public ObservableCollection<GoogleAccount> GoogleAccounts
get { return _googleAccounts; }
set { SetProperty(ref _googleAccounts, value); }
}

private async void AddNewGoogleAccountHandler()
{
//Accept Email Id
Expand Down Expand Up @@ -438,7 +451,7 @@ private async Task<string> GetGoogleAuthCode()
{
return await MessageService.ShowInput("Enter Auth Code after authorization in browser window", "Manual Authentication");
}

#endregion

#region Private Methods
Expand All @@ -452,6 +465,7 @@ private async void SaveSettings()
Settings.AppSettings.MinimizeToSystemTray = MinimizeToSystemTray;
Settings.AppSettings.HideSystemTrayTooltip = HideSystemTrayTooltip;
Settings.AppSettings.CheckForUpdates = CheckForUpdates;
Settings.AppSettings.CheckForAlphaReleases = CheckForAlphaReleases;
Settings.AppSettings.RunApplicationAtSystemStartup = RunApplicationAtSystemStartup;
Settings.AppSettings.IsManualSynchronization = IsManualSynchronization;
Settings.AllowManualAuthentication = AllowManualGoogleAuth;
Expand Down Expand Up @@ -542,6 +556,7 @@ private void LoadSettingsAndGetCalendars()
MinimizeToSystemTray = Settings.AppSettings.MinimizeToSystemTray;
HideSystemTrayTooltip = Settings.AppSettings.HideSystemTrayTooltip;
CheckForUpdates = Settings.AppSettings.CheckForUpdates;
CheckForAlphaReleases = Settings.AppSettings.CheckForAlphaReleases;
RunApplicationAtSystemStartup = Settings.AppSettings.RunApplicationAtSystemStartup;
IsManualSynchronization = Settings.AppSettings.IsManualSynchronization;
LoadProfiles();
Expand Down Expand Up @@ -636,7 +651,7 @@ private async void DisconnectGoogleHandler()
profileViewModel.SelectedCalendar = null;
}
}

GoogleAccounts.Remove(googleAccount);

await MessageService.ShowMessage("Google account successfully disconnected");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,21 @@ public DelegateCommand ShowWhatsNewCommand
}
}

public DelegateCommand ClearLogCommand
{
get
{
return _clearLogCommand ??
(_clearLogCommand = new DelegateCommand(ClearLog));
}
}

private void ClearLog()
{
_statusBuilder.Clear();
RaisePropertyChanged("SyncLog");
}

private void ShowWhatsNew()
{
var contentView = ChildContentViewFactory.GetChildContentViewModel(ChildViewContentType.WhatsNew);
Expand Down Expand Up @@ -391,7 +406,14 @@ private void UpdateContinuationAction(Task<string> task)

private void Download(object o)
{
Process.Start(new ProcessStartInfo(ApplicationUpdateService.GetDownloadUri().AbsoluteUri));
try
{
Process.Start(new ProcessStartInfo(ApplicationUpdateService.GetDownloadUri().AbsoluteUri));
}
catch (Exception exception)
{
ApplicationLogger.LogError(exception);
}
}

private void UpdateStatus(string text)
Expand All @@ -400,7 +422,7 @@ private void UpdateStatus(string text)
{
if (IsSyncInProgress && !text.Equals(StatusHelper.LineConstant))
{
UpdateNotification(text);
UpdateNotification(text);
}
_statusBuilder.AppendLine(text);
ApplicationLogger.LogInfo(text);
Expand Down Expand Up @@ -452,6 +474,7 @@ private void BeginInvokeOnCurrentDispatcher(Action action)

private static readonly object lockerObject = new object();
private DelegateCommand _showWhatsNewCommand;
private DelegateCommand _clearLogCommand;

private void OnTimerElapsed(object sender, ElapsedEventArgs e)
{
Expand Down Expand Up @@ -668,7 +691,7 @@ public void CheckForUpdates()
if (_lastCheckDateTime == null ||
DateTime.Now.Subtract(_lastCheckDateTime.GetValueOrDefault()).TotalHours > 6)
{
Task<string>.Factory.StartNew(() => ApplicationUpdateService.GetLatestReleaseFromServer())
Task<string>.Factory.StartNew(() => ApplicationUpdateService.GetLatestReleaseFromServer(Settings.AppSettings.CheckForAlphaReleases))
.ContinueWith(UpdateContinuationAction);
}
}
Expand Down
Binary file modified src/CalendarSyncPlus/CalendarSyncPlus.BootstrapperUI/icon.ico
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources2.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -573,9 +573,18 @@ Select Outlook &lt;-&gt; Google, to sync our Outlook and Google calendar with ea
<value>Next Scheduled</value>
</data>
<data name="OptionsSettingsView_CheckBox_OtherOptions_MergeExistingEntries_Content" xml:space="preserve">
<value>Merge into Existing Entries</value>
<value>Update Existing Entries</value>
</data>
<data name="OptionsSettingsView_ContentControl_OtherOptions_MergeExistingEntries_Content" xml:space="preserve">
<value>Update existing entries for any changes, instead of adding and deleting for updation</value>
</data>
<data name="AdvancedSettingsView_Checkbox_AlphaCheckForUpdates_Content" xml:space="preserve">
<value>Include Alpha Releases</value>
</data>
<data name="AdvancedSettingsView_ContentControl_AlphaCheckForUpdates_Tooltip" xml:space="preserve">
<value>Check for alpha releases of the application</value>
</data>
<data name="HomeView_Button_ClearLog_Content" xml:space="preserve">
<value>Clear Log</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ public class AppSettings : Model
private bool _isManualSynchronization;

#region Properties

public bool MinimizeToSystemTray { get; set; }

public bool HideSystemTrayTooltip { get; set; }

public bool CheckForUpdates { get; set; }

public bool CheckForAlphaReleases { get; set; }

public bool IsManualSynchronization
{
get { return _isManualSynchronization; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<bal:WixStandardBootstrapperApplication
LicenseUrl="http://calendarsyncplus.codeplex.com/license"
LicenseFile="license.rtf"
LogoFile="icon.ico"
ShowVersion="yes" LogoSideFile="icon.ico"
LogoFile="Logo.png"
ShowVersion="yes"
SuppressOptionsUI="yes"/>
</BootstrapperApplicationRef>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
</WixExtension>
</ItemGroup>
<ItemGroup>
<Content Include="Logo.png" />
<Content Include="icon.ico" />
<Content Include="license.rtf" />
<Content Include="Net45Installer\dotNetFx45_Full_setup.exe" />
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/CalendarSyncPlus/CalendarSyncPlus.InstallerBundle/icon.ico
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -661,26 +661,7 @@ public async Task<CalendarAppointments> GetCalendarEventsInRangeAsync(DateTime s
await
Task<List<Appointment>>.Factory.StartNew(
() => GetAppointments(startDate, endDate));



//var rangeList = SplitDateRange(startDate, endDate, dayChunkSize: (1460));
//foreach (Tuple<DateTime, DateTime> rangeTuple in rangeList)
//{
// //Get Outlook Entries
// Tuple<DateTime, DateTime> tuple = rangeTuple;
// List<Appointment> appointmentList =
// await
// Task<List<Appointment>>.Factory.StartNew(
// () => GetAppointments(tuple.Item1, tuple.Item2));


// if (appointmentList != null)
// {
// calendarAppointments.AddRange(appointmentList);
// }
//}


if (appointmentList == null)
{
return null;
Expand Down
Loading

0 comments on commit 5c0d97a

Please sign in to comment.