Пример #1
0
        public MainWindow()
        {
            InitializeComponent();
            Uri uri = new Uri("pack://application:,,,/B_32x32.ico", UriKind.RelativeOrAbsolute);

            this.Icon = BitmapFrame.Create(uri);
            try
            {
                _settings = ProgramSettings.Load("Settings.xml");
            }
            catch (Exception)
            {
                _settings = new ProgramSettings();
            }
            // Show map and status dialog by default.
            if (_mapDlg == null)
            {
                _mapDlg      = new Map();
                _mapDlg.Top  = 6;
                _mapDlg.Left = 6;
            }
            _mapDlg.Show();
            if (_statusDlg == null)
            {
                _statusDlg      = new Status();
                _statusDlg.Top  = 420;
                _statusDlg.Left = 6;
            }
            _statusDlg.Show();
            if (_equipmentDlg == null)
            {
                _equipmentDlg      = new Equipment();
                _equipmentDlg.Top  = 6;
                _equipmentDlg.Left = 924;
                if (_settings.ShowEquipment)
                {
                    _equipmentDlg.Show();
                }
            }
            if (_settings.ShowHotKeys)
            {
                _hotkeysDlg      = new Hotkeys(this, _settings);
                _hotkeysDlg.Left = 326;
                _hotkeysDlg.Top  = 716;
                _hotkeysDlg.Show();
            }
            if (_settings.ShowGroup)
            {
                _groupDlg      = new Group();
                _groupDlg.Top  = 606;
                _groupDlg.Left = 924;
                _groupDlg.Show();
            }
            this.Top  = 6;
            this.Left = 326;
        }
Пример #2
0
 public MainWindow()
 {
     InitializeComponent();
     Uri uri = new Uri("pack://application:,,,/B_32x32.ico", UriKind.RelativeOrAbsolute);
     this.Icon = BitmapFrame.Create(uri);
     try
     {
         _settings = ProgramSettings.Load("Settings.xml");
     }
     catch (Exception)
     {
         _settings = new ProgramSettings();
     }
     // Show map and status dialog by default.
     if (_mapDlg == null)
     {
         _mapDlg = new Map();
         _mapDlg.Top = 6;
         _mapDlg.Left = 6;
     }
     _mapDlg.Show();
     if (_statusDlg == null)
     {
         _statusDlg = new Status();
         _statusDlg.Top = 420;
         _statusDlg.Left = 6;
     }
     _statusDlg.Show();
     if (_equipmentDlg == null)
     {
         _equipmentDlg = new Equipment();
         _equipmentDlg.Top = 6;
         _equipmentDlg.Left = 924;
         if (_settings.ShowEquipment)
         {
             _equipmentDlg.Show();
         }
     }
     if (_settings.ShowHotKeys)
     {
         _hotkeysDlg = new Hotkeys(this, _settings);
         _hotkeysDlg.Left = 326;
         _hotkeysDlg.Top = 716;
         _hotkeysDlg.Show();
     }
     if (_settings.ShowGroup)
     {
         _groupDlg = new Group();
         _groupDlg.Top = 606;
         _groupDlg.Left = 924;
         _groupDlg.Show();
     }
     this.Top = 6;
     this.Left = 326;
 }
Пример #3
0
 private void Settings_Click(object sender, RoutedEventArgs e)
 {
     if (_settings == null)
     {
         _settings = new ProgramSettings();
     }
     if (_settingsDlg == null)
     {
         _settingsDlg = new Settings(_settings);
     }
     _settingsDlg.Show();
 }
Пример #4
0
 public Settings(ProgramSettings settings)
 {
     _settings = settings;
     InitializeComponent();
     Uri uri = new Uri("pack://application:,,,/B_32x32.ico", UriKind.RelativeOrAbsolute);
     this.Icon = BitmapFrame.Create(uri);
     txtAddress.Text = settings.MUDAddress;
     txtPort.Text = settings.MUDPort.ToString();
     txtNumHotKeys.Text = _settings.NumHotKeys.ToString();
     chkShowHotkeys.IsChecked = _settings.ShowHotKeys;
     chkShowEquipment.IsChecked = _settings.ShowEquipment;
     chkShowGroup.IsChecked = _settings.ShowGroup;
 }
Пример #5
0
        public Settings(ProgramSettings settings)
        {
            _settings = settings;
            InitializeComponent();
            Uri uri = new Uri("pack://application:,,,/B_32x32.ico", UriKind.RelativeOrAbsolute);

            this.Icon                  = BitmapFrame.Create(uri);
            txtAddress.Text            = settings.MUDAddress;
            txtPort.Text               = settings.MUDPort.ToString();
            txtNumHotKeys.Text         = _settings.NumHotKeys.ToString();
            chkShowHotkeys.IsChecked   = _settings.ShowHotKeys;
            chkShowEquipment.IsChecked = _settings.ShowEquipment;
            chkShowGroup.IsChecked     = _settings.ShowGroup;
        }
Пример #6
0
 private void ConnectLocal_Click(object sender, RoutedEventArgs e)
 {
     if (_connection == null)
     {
         _connection = new SocketConnection(ReceiveCallback);
     }
     if (_settings == null)
     {
         _settings = new ProgramSettings();
     }
     AppendColoredText("Connecting to localhost port 4502\n", Brushes.White);
     _connection.Connect("127.0.0.1", 4502);
     // Change to the input window because they're going to need to type something.
     Keyboard.Focus(txtInput);
 }
Пример #7
0
 private void Connect_Click(object sender, RoutedEventArgs e)
 {
     if (_connection == null)
     {
         _connection = new SocketConnection(ReceiveCallback);
     }
     if (_settings == null)
     {
         _settings = new ProgramSettings();
     }
     AppendColoredText("Connecting to " + _settings.MUDAddress + " port " + _settings.MUDPort.ToString() + "\n", Brushes.White);
     _connection.Connect(_settings.MUDAddress, _settings.MUDPort);
     // Change to the input window because they're going to need to type something.
     Keyboard.Focus(txtInput);
 }
Пример #8
0
        public Hotkeys(MainWindow parentwindow, ProgramSettings settings)
        {
            programSettings = settings;
            parent          = parentwindow;
            InitializeComponent();
            rightClickGesture.MouseAction = MouseAction.RightClick;
            MouseBinding  rightClickBinding = new MouseBinding();
            RoutedCommand rightClickCmd     = new RoutedCommand();

            rightClickBinding.Gesture = rightClickGesture;
            rightClickBinding.Command = rightClickCmd;
            CommandBinding rightClickCmdBinding = new CommandBinding();

            rightClickCmdBinding.Command   = rightClickCmd;
            rightClickCmdBinding.Executed += Button_RightClick;
            Uri uri = new Uri("pack://application:,,,/B_32x32.ico", UriKind.RelativeOrAbsolute);

            this.Icon = BitmapFrame.Create(uri);
            for (int i = 0; i < programSettings.NumHotKeys; i++)
            {
                Button btn = new Button();
                btn.Name   = "btn" + i.ToString();
                btn.Click += Button_Click;
                btn.Width  = 56;
                btn.InputBindings.Add(rightClickBinding);
                btn.CommandBindings.Add(rightClickCmdBinding);
                pnlButtons.Children.Add(btn);
                if (programSettings.HotkeyCommands.Count <= i)
                {
                    Alias alias = new Alias();
                    alias.Keyword   = "(None)";
                    btn.Content     = "(none)";
                    alias.Expansion = String.Empty;
                    programSettings.HotkeyCommands.Add(alias);
                }
                else
                {
                    btn.Content = programSettings.HotkeyCommands[i].Keyword;
                }
            }
        }
Пример #9
0
 public Hotkeys(MainWindow parentwindow, ProgramSettings settings)
 {
     programSettings = settings;
     parent = parentwindow;
     InitializeComponent();
     rightClickGesture.MouseAction = MouseAction.RightClick;
     MouseBinding rightClickBinding = new MouseBinding();
     RoutedCommand rightClickCmd = new RoutedCommand();
     rightClickBinding.Gesture = rightClickGesture;
     rightClickBinding.Command = rightClickCmd;
     CommandBinding rightClickCmdBinding = new CommandBinding();
     rightClickCmdBinding.Command = rightClickCmd;
     rightClickCmdBinding.Executed += Button_RightClick;
     Uri uri = new Uri("pack://application:,,,/B_32x32.ico", UriKind.RelativeOrAbsolute);
     this.Icon = BitmapFrame.Create(uri);
     for (int i = 0; i < programSettings.NumHotKeys; i++)
     {
         Button btn = new Button();
         btn.Name = "btn" + i.ToString();
         btn.Click += Button_Click;
         btn.Width = 56;
         btn.InputBindings.Add(rightClickBinding);
         btn.CommandBindings.Add(rightClickCmdBinding);
         pnlButtons.Children.Add(btn);
         if (programSettings.HotkeyCommands.Count <= i)
         {
             Alias alias = new Alias();
             alias.Keyword = "(None)";
             btn.Content = "(none)";
             alias.Expansion = String.Empty;
             programSettings.HotkeyCommands.Add(alias);
         }
         else
         {
             btn.Content = programSettings.HotkeyCommands[i].Keyword;
         }
     }
 }
Пример #10
0
 private void Load_Click(object sender, RoutedEventArgs e)
 {
     _settings = ProgramSettings.Load("Settings.xml");
 }
Пример #11
0
 private void Settings_Click(object sender, RoutedEventArgs e)
 {
     if (_settings == null)
     {
         _settings = new ProgramSettings();
     }
     if (_settingsDlg == null)
     {
         _settingsDlg = new Settings(_settings);
     }
     _settingsDlg.Show();
 }
Пример #12
0
 private void Load_Click(object sender, RoutedEventArgs e)
 {
     _settings = ProgramSettings.Load("Settings.xml");
 }
Пример #13
0
 private void Connect_Click(object sender, RoutedEventArgs e)
 {
     if (_connection == null)
     {
         _connection = new SocketConnection(ReceiveCallback);
     }
     if (_settings == null)
     {
         _settings = new ProgramSettings();
     }
     AppendColoredText("Connecting to " + _settings.MUDAddress + " port " + _settings.MUDPort.ToString() + "\n", Brushes.White);
     _connection.Connect(_settings.MUDAddress, _settings.MUDPort);
     // Change to the input window because they're going to need to type something.
     Keyboard.Focus(txtInput);
 }
Пример #14
0
 private void ConnectLocal_Click(object sender, RoutedEventArgs e)
 {
     if (_connection == null)
     {
         _connection = new SocketConnection(ReceiveCallback);
     }
     if (_settings == null)
     {
         _settings = new ProgramSettings();
     }
     AppendColoredText("Connecting to localhost port 4502\n", Brushes.White);
     _connection.Connect("127.0.0.1", 4502);
     // Change to the input window because they're going to need to type something.
     Keyboard.Focus(txtInput);
 }