예제 #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;
        }
예제 #2
0
파일: Settings.cs 프로젝트: dgis/CodeTV
 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;
 }