59 lines
1.2 KiB
C#
59 lines
1.2 KiB
C#
/*
|
|
* Created by SharpDevelop.
|
|
* User: EVXIO
|
|
* Date: 4/4/2025
|
|
* Time: 1:59 AM
|
|
*
|
|
* To change this template use Tools | Options | Coding | Edit Standard Headers.
|
|
*/
|
|
using System;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
|
|
namespace UPSNet
|
|
{
|
|
/// <summary>
|
|
/// Description of ConfigForm.
|
|
/// </summary>
|
|
public partial class ConfigForm : Form {
|
|
public ConfigForm() {
|
|
//
|
|
// The InitializeComponent() call is required for Windows Forms designer support.
|
|
//
|
|
InitializeComponent();
|
|
|
|
//
|
|
// TODO: Add constructor code after the InitializeComponent() call.
|
|
//
|
|
LoadConfig();
|
|
}
|
|
|
|
void LoadConfig(){
|
|
textBoxAddress.Text = UPSApp.deviceAddress;
|
|
int modeIdx = UPSApp.shutdownMode;
|
|
if (modeIdx<0) modeIdx = 0;
|
|
if (modeIdx>6) modeIdx = 6;
|
|
comboBoxShutMode.SelectedIndex = modeIdx;
|
|
}
|
|
|
|
void ButtonCancelClick(object sender, EventArgs e) {
|
|
this.Close();
|
|
}
|
|
|
|
void ButtonOkClick(object sender, EventArgs e) {
|
|
UPSApp.deviceAddress = textBoxAddress.Text;
|
|
UPSApp.shutdownMode = comboBoxShutMode.SelectedIndex;
|
|
UPSApp.SaveConfig();
|
|
UPSApp.RestartFetcher();
|
|
UPSApp.dialogOk = true;
|
|
this.Close();
|
|
}
|
|
|
|
void ConfigFormShown(object sender, EventArgs e){
|
|
LoadConfig();
|
|
}
|
|
|
|
|
|
}
|
|
}
|