本文整理汇总了C#中SparkleShare.SparklePlugin类的典型用法代码示例。如果您正苦于以下问题:C# SparklePlugin类的具体用法?C# SparklePlugin怎么用?C# SparklePlugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SparklePlugin类属于SparkleShare命名空间,在下文中一共展示了SparklePlugin类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SparkleSetupController
public SparkleSetupController ()
{
ChangePageEvent += delegate (PageType page_type, string [] warnings) {
this.current_page = page_type;
};
TutorialPageNumber = 0;
PreviousAddress = "";
PreviousPath = "";
PreviousUrl = "";
SyncingFolder = "";
string local_plugins_path = SparklePlugin.LocalPluginsPath;
int local_plugins_count = 0;
// Import all of the plugins
if (Directory.Exists (local_plugins_path))
// Local plugins go first...
foreach (string xml_file_path in Directory.GetFiles (local_plugins_path, "*.xml")) {
Plugins.Add (new SparklePlugin (xml_file_path));
local_plugins_count++;
}
// ...system plugins after that...
if (Directory.Exists (Program.Controller.PluginsPath)) {
foreach (string xml_file_path in Directory.GetFiles (Program.Controller.PluginsPath, "*.xml")) {
// ...and "Own server" at the very top
if (xml_file_path.EndsWith ("own-server.xml")) {
Plugins.Insert (0, new SparklePlugin (xml_file_path));
} else if (xml_file_path.EndsWith ("ssnet.xml")) {
// Plugins.Insert ((local_plugins_count + 1), new SparklePlugin (xml_file_path)); TODO: Skip this plugin for now
} else {
Plugins.Add (new SparklePlugin (xml_file_path));
}
}
}
SelectedPlugin = Plugins [0];
Program.Controller.InviteReceived += delegate (SparkleInvite invite) {
PendingInvite = invite;
ChangePageEvent (PageType.Invite, null);
ShowWindowEvent ();
};
Program.Controller.ShowSetupWindowEvent += delegate (PageType page_type) {
if (page_type == PageType.CryptoSetup || page_type == PageType.CryptoPassword) {
ChangePageEvent (page_type, null);
return;
}
if (PendingInvite != null) {
WindowIsOpen = true;
ShowWindowEvent ();
return;
}
if (this.current_page == PageType.Syncing ||
this.current_page == PageType.Finished ||
this.current_page == PageType.CryptoSetup ||
this.current_page == PageType.CryptoPassword) {
ShowWindowEvent ();
return;
}
if (page_type == PageType.Add) {
if (WindowIsOpen) {
if (this.current_page == PageType.Error ||
this.current_page == PageType.Finished ||
this.current_page == PageType.None) {
ChangePageEvent (PageType.Add, null);
}
ShowWindowEvent ();
} else if (!Program.Controller.FirstRun && TutorialPageNumber == 0) {
WindowIsOpen = true;
ChangePageEvent (PageType.Add, null);
ShowWindowEvent ();
}
return;
}
WindowIsOpen = true;
ChangePageEvent (page_type, null);
ShowWindowEvent ();
};
}
示例2: SparkleSetupController
public SparkleSetupController()
{
TutorialPageNumber = 0;
PreviousAddress = "";
PreviousPath = "";
PreviousUrl = "";
SyncingFolder = "";
string local_plugins_path = SparklePlugin.LocalPluginsPath;
// Import all of the plugins
if (Directory.Exists (local_plugins_path))
// Local plugins go first...
foreach (string xml_file_path in Directory.GetFiles (local_plugins_path, "*.xml"))
Plugins.Add (new SparklePlugin (xml_file_path));
// ...system plugins after that...
if (Directory.Exists (Program.Controller.PluginsPath)) {
foreach (string xml_file_path in Directory.GetFiles (Program.Controller.PluginsPath, "*.xml")) {
// ...and "Own server" at the very top
if (xml_file_path.EndsWith ("own-server.xml"))
Plugins.Insert (0, new SparklePlugin (xml_file_path));
else
Plugins.Add (new SparklePlugin (xml_file_path));
}
}
SelectedPlugin = Plugins [0];
Program.Controller.InviteReceived += delegate (SparkleInvite invite) {
PendingInvite = invite;
if (ChangePageEvent != null)
ChangePageEvent (PageType.Invite, null);
if (ShowWindowEvent != null)
ShowWindowEvent ();
};
Program.Controller.ShowSetupWindowEvent += delegate (PageType page_type) {
if (PendingInvite != null) {
if (ShowWindowEvent != null)
ShowWindowEvent ();
return;
}
if (page_type == PageType.Add) {
if (!Program.Controller.FirstRun && TutorialPageNumber == 0) {
if (ChangePageEvent != null)
ChangePageEvent (page_type, null);
if (ShowWindowEvent != null)
ShowWindowEvent ();
}
return;
}
if (ChangePageEvent != null)
ChangePageEvent (page_type, null);
if (ShowWindowEvent != null)
ShowWindowEvent ();
};
}
示例3: SparkleSetupController
public SparkleSetupController()
{
string local_plugins_path = SparkleHelpers.CombineMore (
Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData),
"sparkleshare", "plugins");
if (Directory.Exists (local_plugins_path))
foreach (string xml_file_path in Directory.GetFiles (local_plugins_path, "*.xml"))
Plugins.Add (new SparklePlugin (xml_file_path));
if (Directory.Exists (Program.Controller.PluginsPath)) {
foreach (string xml_file_path in Directory.GetFiles (Program.Controller.PluginsPath, "*.xml")) {
if (xml_file_path.EndsWith ("own-server.xml"))
Plugins.Insert (0, new SparklePlugin (xml_file_path));
else
Plugins.Add (new SparklePlugin (xml_file_path));
}
}
SelectedPlugin = Plugins [0];
ChangePageEvent += delegate (PageType page, string [] warning) {
this.previous_page = page;
};
}
示例4: SparkleSetupController
public SparkleSetupController()
{
TutorialPageNumber = 0;
PreviousAddress = "";
PreviousPath = "";
PreviousUrl = "";
SyncingFolder = "";
string local_plugins_path = SparkleHelpers.CombineMore (
Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData),
"sparkleshare", "plugins");
if (Directory.Exists (local_plugins_path))
foreach (string xml_file_path in Directory.GetFiles (local_plugins_path, "*.xml"))
Plugins.Add (new SparklePlugin (xml_file_path));
if (Directory.Exists (Program.Controller.PluginsPath)) {
foreach (string xml_file_path in Directory.GetFiles (Program.Controller.PluginsPath, "*.xml")) {
if (xml_file_path.EndsWith ("own-server.xml"))
Plugins.Insert (0, new SparklePlugin (xml_file_path));
else
Plugins.Add (new SparklePlugin (xml_file_path));
}
}
SelectedPlugin = Plugins [0];
Program.Controller.InviteReceived += delegate (SparkleInvite invite) {
PendingInvite = invite;
if (ChangePageEvent != null)
ChangePageEvent (PageType.Invite, null);
if (ShowWindowEvent != null)
ShowWindowEvent ();
};
Program.Controller.ShowSetupWindowEvent += delegate (PageType page_type) {
if (PendingInvite != null) {
if (ShowWindowEvent != null)
ShowWindowEvent ();
return;
}
if (page_type == PageType.Add) {
if (!Program.Controller.FirstRun && TutorialPageNumber == 0) {
if (ChangePageEvent != null)
ChangePageEvent (page_type, null);
if (ShowWindowEvent != null)
ShowWindowEvent ();
SelectedPluginChanged (SelectedPluginIndex);
}
return;
}
if (ChangePageEvent != null)
ChangePageEvent (page_type, null);
if (ShowWindowEvent != null)
ShowWindowEvent ();
};
}
示例5: SelectedPluginChanged
public void SelectedPluginChanged (int plugin_index)
{
SelectedPlugin = Plugins [plugin_index];
if (SelectedPlugin.Address != null) {
ChangeAddressFieldEvent (SelectedPlugin.Address, "", FieldState.Disabled);
} else if (SelectedPlugin.AddressExample != null) {
ChangeAddressFieldEvent (this.saved_address, SelectedPlugin.AddressExample, FieldState.Enabled);
} else {
ChangeAddressFieldEvent (this.saved_address, "", FieldState.Enabled);
}
if (SelectedPlugin.Path != null) {
ChangePathFieldEvent (SelectedPlugin.Path, "", FieldState.Disabled);
} else if (SelectedPlugin.PathExample != null) {
ChangePathFieldEvent (this.saved_remote_path, SelectedPlugin.PathExample, FieldState.Enabled);
} else {
ChangePathFieldEvent (this.saved_remote_path, "", FieldState.Enabled);
}
}
示例6: FinishPageCompleted
public void FinishPageCompleted ()
{
SelectedPlugin = Plugins [0];
PreviousUrl = "";
PreviousAddress = "";
PreviousPath = "";
this.fetch_prior_history = false;
this.current_page = PageType.None;
HideWindowEvent ();
}
示例7: PageCancelled
public void PageCancelled ()
{
PendingInvite = null;
SelectedPlugin = Plugins [0];
PreviousAddress = "";
PreviousPath = "";
PreviousUrl = "";
this.fetch_prior_history = false;
WindowIsOpen = false;
HideWindowEvent ();
}
示例8: PageCancelled
public void PageCancelled()
{
PendingInvite = null;
SelectedPlugin = Plugins [0];
PreviousAddress = "";
PreviousPath = "";
PreviousUrl = "";
if (HideWindowEvent != null)
HideWindowEvent ();
}
示例9: FinishPageCompleted
public void FinishPageCompleted()
{
SelectedPlugin = Plugins [0];
PreviousUrl = "";
PreviousAddress = "";
PreviousPath = "";
Program.Controller.UpdateState ();
if (HideWindowEvent != null)
HideWindowEvent ();
}
示例10: SelectedPluginChanged
public void SelectedPluginChanged(int plugin_index)
{
SelectedPlugin = Plugins [plugin_index];
if (SelectedPlugin.Address != null) {
if (ChangeAddressFieldEvent != null)
ChangeAddressFieldEvent (SelectedPlugin.Address, "", FieldState.Disabled);
} else if (SelectedPlugin.AddressExample != null) {
if (ChangeAddressFieldEvent != null)
ChangeAddressFieldEvent ("", SelectedPlugin.AddressExample, FieldState.Enabled);
} else {
if (ChangeAddressFieldEvent != null)
ChangeAddressFieldEvent ("", "", FieldState.Enabled);
}
if (SelectedPlugin.Path != null) {
if (ChangePathFieldEvent != null)
ChangePathFieldEvent (SelectedPlugin.Path, "", FieldState.Disabled);
} else if (SelectedPlugin.PathExample != null) {
if (ChangePathFieldEvent != null)
ChangePathFieldEvent ("", SelectedPlugin.PathExample, FieldState.Enabled);
} else {
if (ChangePathFieldEvent != null)
ChangePathFieldEvent ("", "", FieldState.Enabled);
}
}
示例11: AddPageCompleted
public void AddPageCompleted(string address, string path)
{
this.syncing_folder = Path.GetFileNameWithoutExtension (path);
this.previous_address = address;
this.previous_path = path;
if (ChangePageEvent != null)
ChangePageEvent (PageType.Syncing, null);
// TODO: Remove events afterwards
Program.Controller.FolderFetched += delegate (string [] warnings) {
if (ChangePageEvent != null)
ChangePageEvent (PageType.Finished, warnings);
this.previous_address = "";
this.syncing_folder = "";
this.previous_url = "";
SelectedPlugin = Plugins [0];
};
Program.Controller.FolderFetchError += delegate (string remote_url) {
this.previous_url = remote_url;
if (ChangePageEvent != null)
ChangePageEvent (PageType.Error, null);
this.syncing_folder = "";
};
Program.Controller.FolderFetching += delegate (double percentage) {
if (UpdateProgressBarEvent != null)
UpdateProgressBarEvent (percentage);
};
Program.Controller.FetchFolder (address, path);
}
示例12: FinishPageCompleted
public void FinishPageCompleted()
{
SelectedPlugin = Plugins [0];
PreviousUrl = "";
PreviousAddress = "";
PreviousPath = "";
this.fetch_prior_history = false;
this.current_page = PageType.None;
if (HideWindowEvent != null)
HideWindowEvent ();
Program.Controller.UpdateState ();
}
示例13: InvitePageCompleted
public void InvitePageCompleted()
{
SyncingFolder = Path.GetFileNameWithoutExtension (PendingInvite.RemotePath);
PreviousAddress = PendingInvite.Address;
// TODO: trailing slash should work
PreviousPath = PendingInvite.RemotePath;
if (ChangePageEvent != null)
ChangePageEvent (PageType.Syncing, null);
if (!PendingInvite.Accept ()) {
if (ChangePageEvent != null)
ChangePageEvent (PageType.Error, null);
return;
}
// TODO: Remove events afterwards
Program.Controller.FolderFetched += delegate (string [] warnings) {
if (ChangePageEvent != null)
ChangePageEvent (PageType.Finished, warnings);
PreviousAddress = "";
SyncingFolder = "";
PreviousUrl = "";
SelectedPlugin = Plugins [0];
PendingInvite = null;
};
Program.Controller.FolderFetchError += delegate (string remote_url) {
Thread.Sleep (1000);
PreviousUrl = remote_url;
if (ChangePageEvent != null)
ChangePageEvent (PageType.Error, null);
SyncingFolder = "";
};
Program.Controller.FolderFetching += delegate (double percentage) {
if (UpdateProgressBarEvent != null)
UpdateProgressBarEvent (percentage);
};
Program.Controller.FetchFolder (PendingInvite.Address,
PendingInvite.RemotePath, PendingInvite.AnnouncementsUrl.ToString ());
}