예제 #1
0
        private void AwakeBotUserInterface_Load(object sender, EventArgs e)
        {
            // Remove the annoying double border from buttons when focus is occured
            btnItemPosition.GotFocus            += (s, ev) => { ((Button)s).NotifyDefault(false); };
            btnAwakeScrollPosition.GotFocus     += (s, ev) => { ((Button)s).NotifyDefault(false); };
            btnReversionScrollPosition.GotFocus += (s, ev) => { ((Button)s).NotifyDefault(false); };
            btnSelectInventory.GotFocus         += (s, ev) => { ((Button)s).NotifyDefault(false); };

            btnItemPosition.MouseUp += (s, ev) =>
            {
                if (TrySetAwakePosition((Control)s))
                {
                    ItemPosition         = Cursor.Position;
                    lblItemPosition.Text = ItemPosition.ToString();
                }
            };

            btnAwakeScrollPosition.MouseUp += (s, ev) =>
            {
                if (TrySetAwakePosition((Control)s))
                {
                    AwakeScrollPosition   = Cursor.Position;
                    lblAwakePosition.Text = AwakeScrollPosition.ToString();
                }
            };

            btnReversionScrollPosition.MouseUp += (s, ev) =>
            {
                if (TrySetAwakePosition((Control)s))
                {
                    ReversionPosition         = Cursor.Position;
                    lblReversionPosition.Text = ReversionPosition.ToString();
                }
            };

            if (!Directory.Exists(ConfigDirectory))
            {
                Directory.CreateDirectory(ConfigDirectory);
            }

            string[] files = Directory.GetFiles(ConfigDirectory, "*.xml");

            if (files.Length <= 0)
            {
                GeneralUtils.DisplayError("No server config files found");
            }

            foreach (var file in files)
            {
                string fileName = file.Substring(file.LastIndexOf('\\') + 1);
                fileName = fileName.Substring(0, fileName.LastIndexOf('.'));
                cbConfigs.Items.Add(fileName);
            }
        }