Changeset 16
- Timestamp:
- 04/08/10 11:04:20 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/desktop/mainWindow.rbfrm
r15 r16 138 138 Top = 32 139 139 Underline = "" 140 Value = 2140 Value = 0 141 141 Visible = True 142 142 Width = 637 … … 2698 2698 //Set the default car type 2699 2699 ICSSerialPort1.setCarType("MR-03") 2700 2701 readPreferences() 2702 2703 //Set and open the COM Port 2704 dim i, count as integer 2705 count = System.SerialPortCount 2706 2707 for i = 0 to count - 1 2708 PopupMenu_SerialPort.AddRow( System.SerialPort(i).Name ) 2709 next 2710 2711 if comPort <> "" then 2712 //We can try opening the com port and set the popup menu to that port 2713 2714 for i = 0 to PopupMenu_SerialPort.ListCount - 1 2715 2716 if PopupMenu_SerialPort.list(i) = comPort then 2717 //Found a match, set and open 2718 PopupMenu_SerialPort.ListIndex = i 2719 ICSSerialPort1.SerialPort = System.SerialPort(i) 2720 2721 if not ICSSerialPort1.Open then 2722 //Could not open 2723 MsgBox "Error opening defined com port" 2724 end if 2725 //No need to continue loop 2726 exit 2727 end if 2728 2729 next 2730 2731 end if 2732 2700 2733 End Sub 2701 2734 #tag EndEvent … … 2967 3000 //Read the settings from the preferences file 2968 3001 if filePreference <> Nil then 2969 xdoc = New XmlDocument(filePreference) 2970 2971 count = xdoc.DocumentElement.ChildCount 2972 2973 for i = 0 to count - 1 2974 root = xdoc.DocumentElement.Child(i) 3002 if filePreference.Exists then 3003 xdoc = New XmlDocument(filePreference) 2975 3004 2976 item = root.FirstChild.Value3005 count = xdoc.DocumentElement.ChildCount 2977 3006 2978 select case root.Name 2979 case "comPort" 2980 comPort = item 2981 end select 2982 next 2983 2984 else 2985 //Do nothing 2986 3007 for i = 0 to count - 1 3008 root = xdoc.DocumentElement.Child(i) 3009 3010 item = root.FirstChild.Value 3011 3012 select case root.Name 3013 case "comPort" 3014 comPort = item 3015 end select 3016 next 3017 end if 2987 3018 end if 3019 3020 2988 3021 End Sub 2989 3022 #tag EndMethod … … 3060 3093 #tag EndEvent 3061 3094 #tag EndEvents 3095 #tag Events PopupMenu_SerialPort 3096 #tag Event 3097 Sub Change() 3098 //Set and open the COM Port 3099 dim i, count as integer 3100 count = System.SerialPortCount 3101 3102 if comPort <> "" then 3103 //We can try opening the com port and set the popup menu to that port 3104 3105 for i = 0 to PopupMenu_SerialPort.ListCount - 1 3106 3107 if PopupMenu_SerialPort.list(i) = me.Text then 3108 //Found a match, set and open 3109 ICSSerialPort1.SerialPort = System.SerialPort(i) 3110 ICSSerialPort1.Close 3111 3112 3113 if not ICSSerialPort1.Open then 3114 //Could not open 3115 MsgBox "Error opening defined com port" 3116 end if 3117 //Save and exit 3118 comPort = me.Text 3119 savePreferences 3120 exit 3121 end if 3122 3123 next 3124 3125 end if 3126 End Sub 3127 #tag EndEvent 3128 #tag EndEvents 3062 3129 #tag Events PopupMenu_Profile 3063 3130 #tag Event
Note: See TracChangeset
for help on using the changeset viewer.