示例#1
0
        public MainWindow()
        {
            Topmost = true;
            InitializeComponent();
            InitializeGeneralSettingsUI();

            var version = Assembly.GetExecutingAssembly().GetName().Version;

            mainWindow.Title       += $" v{version}";
            AppHeaderLabel.Content += $" v{version}";
            Log.Information($"Current version: {version}");

            ironworksContext  = IronworksContext.Instance();
            ironworksSettings = IronworksSettings.Instance;

            Welcome();
            LoadSettings();

            ShowDialogueWindow();

            const int period = 500;

            chatboxTimer = new Timer(UpdateChatbox, null, 0, period);
            Log.Debug($"New RefreshChatbox timer with period {period}ms");
        }
示例#2
0
        private static void InitSettings()
        {
            Directory.CreateDirectory("settings");
            string settingsFilePath = "./settings/settings.json";

            if (File.Exists(settingsFilePath))
            {// Read settings
                using (StreamReader reader = File.OpenText(settingsFilePath))
                {
                    var settings         = reader.ReadToEnd();
                    var previousSettings = JsonConvert.DeserializeObject <IronworksSettings>(settings);
                    IronworksSettings.Instance = previousSettings;
                    Log.Debug("settings.json loaded");
                }
            }
            else
            {// Create new one
                newcomer = true;
                var ironworksSettings = new IronworksSettings();
                IronworksSettings.Instance = ironworksSettings;
                string settings = JsonConvert.SerializeObject(ironworksSettings, Formatting.Indented);
                File.WriteAllText(settingsFilePath, settings);
                Log.Debug("settings.json created");
            }
        }
示例#3
0
        public DialogueWindow(MainWindow mainWindow)
        {
            Topmost = true;
            InitializeComponent();
            ironworksContext  = mainWindow.ironworksContext;
            ironworksSettings = mainWindow.ironworksSettings;
            LoadUISettings();

            const int period = 500;

            chatboxTimer = new Timer(RefreshDialogueTextBox, null, 0, period);
            Log.Debug($"New RefreshChatbox timer with period {period}ms");
        }