Пример #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>
        /// 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();
        }
Пример #3
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);
 }