note controller: Don't fetch avatar on first run
This commit is contained in:
parent
45b7c3230c
commit
48acd5ce41
2
SparkleShare/Mac/EmptyXmlFile.xml
Normal file
2
SparkleShare/Mac/EmptyXmlFile.xml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
|
|
@ -16,9 +16,10 @@
|
||||||
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Net;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
|
using SparkleLib;
|
||||||
|
|
||||||
namespace SparkleShare {
|
namespace SparkleShare {
|
||||||
|
|
||||||
public class SparkleNoteController {
|
public class SparkleNoteController {
|
||||||
|
@ -29,18 +30,15 @@ namespace SparkleShare {
|
||||||
public event UpdateTitleEventDelegate UpdateTitleEvent = delegate { };
|
public event UpdateTitleEventDelegate UpdateTitleEvent = delegate { };
|
||||||
public delegate void UpdateTitleEventDelegate (string title);
|
public delegate void UpdateTitleEventDelegate (string title);
|
||||||
|
|
||||||
public string AvatarFilePath = "";
|
public readonly string AvatarFilePath = "";
|
||||||
public string CurrentProject { get; private set; }
|
public string CurrentProject { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
public SparkleNoteController ()
|
public SparkleNoteController ()
|
||||||
{
|
{
|
||||||
Program.Controller.ShowNoteWindowEvent += delegate (string project) {
|
Program.Controller.ShowNoteWindowEvent += OnNoteWindowEvent;
|
||||||
CurrentProject = project;
|
|
||||||
ShowWindowEvent ();
|
|
||||||
UpdateTitleEvent (CurrentProject);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
if (Program.Controller.AvatarsEnabled && !Program.Controller.FirstRun)
|
||||||
AvatarFilePath = SparkleAvatars.GetAvatar (Program.Controller.CurrentUser.Email,
|
AvatarFilePath = SparkleAvatars.GetAvatar (Program.Controller.CurrentUser.Email,
|
||||||
48, Program.Controller.Config.FullPath);
|
48, Program.Controller.Config.FullPath);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +53,7 @@ namespace SparkleShare {
|
||||||
public void SyncClicked (string note)
|
public void SyncClicked (string note)
|
||||||
{
|
{
|
||||||
HideWindowEvent ();
|
HideWindowEvent ();
|
||||||
new Thread (() => Program.Controller.GetRepoByName (CurrentProject).Resume (note)).Start ();
|
new Thread (() => ResumeWithNote (note)).Start ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,5 +61,21 @@ namespace SparkleShare {
|
||||||
{
|
{
|
||||||
HideWindowEvent ();
|
HideWindowEvent ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void OnNoteWindowEvent (string project)
|
||||||
|
{
|
||||||
|
CurrentProject = project;
|
||||||
|
|
||||||
|
ShowWindowEvent ();
|
||||||
|
UpdateTitleEvent (CurrentProject);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ResumeWithNote (string note)
|
||||||
|
{
|
||||||
|
SparkleRepoBase repo = Program.Controller.GetRepoByName (CurrentProject);
|
||||||
|
repo.Resume (note);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue