Skip to content

Commit

Permalink
refactor: tweak plugin init sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
jim-kirisame committed Sep 7, 2022
1 parent f539722 commit 49e0f58
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions HousingCheck/HousingCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ public class HousingCheck : IActPluginV1
/// 状态信息
/// </summary>
Label statusLabel;
PluginControlWpf control;
PluginControlViewModel vm;

Config config = new Config();
SimpleLoggerSync logger;
Expand Down Expand Up @@ -136,20 +134,12 @@ void IActPluginV1.InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText)
logger = new SimpleLoggerSync(Path.Combine(DataDir, "app.log"));
logger.SetFilter(config.DebugEnabled ? LogLevel.DEBUG : LogLevel.INFO);
storage = new DataStorage(logger);
vm = new PluginControlViewModel(config, logger, storage);
notifier = new Notifier(config);
api = new UploadApi(config);
updater = new ExtendedUpdater("https://tools.lotlab.org/dl/ffxiv/HousingCheckXP/_update/", thisPlugin.pluginFile.DirectoryName);
opcodeRepo = new OpcodeRepo(logger,
Path.Combine(ActGlobals.oFormActMain.AppDataFolder.FullName, "Config", "HousingCheck.opcode.txt"),
"https://tools.lotlab.org/dl/ffxiv/HousingCheckXP/opcode.txt"
);

updateOpcodeFromConfig();
pluginScreenSpace.Text = "房屋信息记录";

control = new PluginControlWpf();
var vm = new PluginControlViewModel(config, logger, storage);
var control = new PluginControlWpf();
control.DataContext = vm;
pluginScreenSpace.Text = "房屋信息记录";
var host = new ElementHost()
{
Dock = DockStyle.Fill,
Expand All @@ -158,6 +148,16 @@ void IActPluginV1.InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText)

pluginScreenSpace.Controls.Add(host);

notifier = new Notifier(config);
api = new UploadApi(config);
updater = new ExtendedUpdater("https://tools.lotlab.org/dl/ffxiv/HousingCheckXP/_update/", thisPlugin.pluginFile.DirectoryName);
opcodeRepo = new OpcodeRepo(logger,
Path.Combine(ActGlobals.oFormActMain.AppDataFolder.FullName, "Config", "HousingCheck.opcode.txt"),
"https://tools.lotlab.org/dl/ffxiv/HousingCheckXP/opcode.txt"
);

updateOpcodeFromConfig();

ffxivPlugin.DataSubscription.NetworkReceived += NetworkReceived;
ffxivPlugin.DataSubscription.NetworkSent += NetworkSent;

Expand Down

0 comments on commit 49e0f58

Please sign in to comment.