Ejemplo n.º 1
0
        public WinLIRCMappingEditorForm(Settings settings)
        {
            InitializeComponent();

            this.settings = settings;

            this.winLIRCcommandMapping = new Hashtable(this.settings.WinLIRCCommandMapping);

            this.winLIRC = new WinLIRC();
            this.winLIRC.SyncControl = this;
            this.winLIRC.HostName = this.settings.WinLIRCHostName;
            this.winLIRC.Port = this.settings.WinLIRCPort;
            this.winLIRC.CommandReceived += new WinLIRC.CommandReceivedEventHandler(winLIRC_CommandReceived);

            foreach (string winLIRCCommand in this.winLIRCcommandMapping.Keys)
            {
                ListViewItem lvi = new ListViewItem(winLIRCCommand);
                lvi.SubItems.Add(((MainForm.CommandName)this.winLIRCcommandMapping[winLIRCCommand]).ToString());
                this.listViewCommandMapping.Items.Add(lvi);
            }

            this.comboBoxApplicationCommand.Items.AddRange(Enum.GetNames(typeof(MainForm.CommandName)));
            this.comboBoxApplicationCommand.SelectedIndex = 0;
        }
Ejemplo n.º 2
0
 public static Settings Load(string fileName)
 {
     Settings tvntSettings = null;
     FileStream fileStream = null;
     try
     {
         fileStream = new FileStream(fileName, FileMode.Open);
         tvntSettings = Settings.Deserialize(fileStream);
     }
     catch (FileNotFoundException)
     {
         tvntSettings = new Settings();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         if (fileStream != null)
             fileStream.Close();
     }
     return tvntSettings;
 }