コード例 #1
0
        /// <summary>
        /// Menu Item "Parameter"
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Settings_EventHandler(object sender, RoutedEventArgs e)
        {
            // Disable the Editing functions if we are currently connected
            bool connectionState = true;

            if (connection.connectionStateCommuniation1 > 0 || connection.connectionStateCommuniation2 > 0)
            {
                connectionState = false;
            }

            // Create an Settings View
            ConnectionSettings_UI paramWindow = new ConnectionSettings_UI(settings.connectionSettings, connectionState);

            // Set the position of the Settings Dialog to the Connecty Main Window...
            var currentWindowPosition = this.PointToScreen(new Point(0, 0));

            paramWindow.Left = currentWindowPosition.X; // This is not working since the Width of the Window is not set yet => //+ (this.Width/2) - (paramWindow.Width/2);
            paramWindow.Top  = currentWindowPosition.Y; // This is not working since the Width of the Window is not set yet => //+ (this.Height/2) - (paramWindow.Height/2);


            if (paramWindow.ShowDialog() == true)
            {
                // Get the User entered Data from the Settings Window
                settings.connectionSettings = paramWindow.getUserParams;

                // Update the Main Window Title
                updateMainWindowTitle();

                // Save the Data to the File System
                LoadSave.saveSettings(System.AppDomain.CurrentDomain.BaseDirectory, settings);
            }
        }
コード例 #2
0
        /// <summary>
        /// Open Settings was triggerd
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OpenExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            ConnectySetings loadedSettings = LoadSave.openSettings();

            if (loadedSettings != null)
            {
                settings = loadedSettings;
                updateMainWindowTitle();
                UpdateViewStateDependence(settings.viewSettings);

                // In case we got a different Connection Settings we will disconnect the Current Connection
                ConnectionInterface_Disconnect();
            }
        }
コード例 #3
0
        /// <summary>
        /// Window Closing
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            // Save the Window Position.
            settings.applicationSettings.position = new Point(this.Left, this.Top);

            // Save the Height and the Width of the Window.
            settings.applicationSettings.width  = this.Width;
            settings.applicationSettings.height = this.Height;


            // Try to save the Settings
            LoadSave.saveSettings(System.AppDomain.CurrentDomain.BaseDirectory, settings);

            // Disconnect the Connections
            ConnectionInterface_Disconnect();

            CloseAllSimulationUi();
        }
コード例 #4
0
        /// <summary>
        /// Main Window Constructor
        /// </summary>
        public MainWindow()
        {
            // Load the Default Settings
            settings = LoadSave.loadSettings(System.AppDomain.CurrentDomain.BaseDirectory);

            // Create a new Connection Interface Object
            connection = new FunctionInterface();
            connection.StatusbarUpdate += new ConnectionStateUpdateEventHandler(UpdateConnectionState_Event);
            connection.SendRecived     += new MsgSendRecivedEventHandler(MsgSendRecived_Event);


            msgLog.viewSettings = settings.viewSettings;


            // Init the UI
            InitializeComponent();

            // Add some Hot Keys and bind the Eventhandlers to the UI
            AddHotKeys();

            // Init the UI
            tbSendData.Text = "";    // Erase the Textbox Send Data
            updateMainWindowTitle(); // Update the Main Window Title


            // Try to set the Position , the Height and the Width
            this.Left   = settings.applicationSettings.position.X;
            this.Top    = settings.applicationSettings.position.Y;
            this.Width  = settings.applicationSettings.width;
            this.Height = settings.applicationSettings.height;

            // Update the UI with the Current View Settings
            UpdateViewStateDependence(msgLog.viewSettings);

            // Update the Statusbar
            update_StatusBarSendTo(connectionSelectionSendData);

            // Debug Stuff
            debugStuff();
        }
コード例 #5
0
 /// <summary>
 /// Safe Settings was triggerd
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void SaveExecuted(object sender, ExecutedRoutedEventArgs e)
 {
     LoadSave.saveSettings(settings);
 }