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.Net;
|
||||
using System.Threading;
|
||||
|
||||
using SparkleLib;
|
||||
|
||||
namespace SparkleShare {
|
||||
|
||||
public class SparkleNoteController {
|
||||
|
@ -29,20 +30,17 @@ namespace SparkleShare {
|
|||
public event UpdateTitleEventDelegate UpdateTitleEvent = delegate { };
|
||||
public delegate void UpdateTitleEventDelegate (string title);
|
||||
|
||||
public string AvatarFilePath = "";
|
||||
public readonly string AvatarFilePath = "";
|
||||
public string CurrentProject { get; private set; }
|
||||
|
||||
|
||||
public SparkleNoteController ()
|
||||
{
|
||||
Program.Controller.ShowNoteWindowEvent += delegate (string project) {
|
||||
CurrentProject = project;
|
||||
ShowWindowEvent ();
|
||||
UpdateTitleEvent (CurrentProject);
|
||||
};
|
||||
Program.Controller.ShowNoteWindowEvent += OnNoteWindowEvent;
|
||||
|
||||
AvatarFilePath = SparkleAvatars.GetAvatar (Program.Controller.CurrentUser.Email,
|
||||
48, Program.Controller.Config.FullPath);
|
||||
if (Program.Controller.AvatarsEnabled && !Program.Controller.FirstRun)
|
||||
AvatarFilePath = SparkleAvatars.GetAvatar (Program.Controller.CurrentUser.Email,
|
||||
48, Program.Controller.Config.FullPath);
|
||||
}
|
||||
|
||||
|
||||
|
@ -55,7 +53,7 @@ namespace SparkleShare {
|
|||
public void SyncClicked (string note)
|
||||
{
|
||||
HideWindowEvent ();
|
||||
new Thread (() => Program.Controller.GetRepoByName (CurrentProject).Resume (note)).Start ();
|
||||
new Thread (() => ResumeWithNote (note)).Start ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,5 +61,21 @@ namespace SparkleShare {
|
|||
{
|
||||
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