Exemple #1
0
		internal void AddProfile(ProfileSetting profile) {
			string sProfileId = profile.ProfileId;
			lock (__cProfiles) {
				if (!__cProfiles.ContainsKey(sProfileId)) {
					__cProfiles.Add(sProfileId, profile);
				}
			}
		}
Exemple #2
0
		private void CreateScriptViewer(ProfileSetting profile) {
			frmSignalViewer frmSignalViewer = new frmSignalViewer();
			frmSignalViewer.SetProfileSetting(profile);
			frmSignalViewer.TopLevel = false;

			panelForms.Controls.Add(frmSignalViewer);
			frmSignalViewer.Show();
		}
Exemple #3
0
        internal void AddProfile(ProfileSetting profile)
        {
            string sProfileId = profile.ProfileId;

            lock (__cProfiles) {
                if (!__cProfiles.ContainsKey(sProfileId))
                {
                    __cProfiles.Add(sProfileId, profile);
                }
            }
        }
Exemple #4
0
		internal static ProfileSetting CreateProfile(JToken setting) {
			ProfileSetting cProfile = new ProfileSetting();
			int iScriptType = setting["ScriptType"].Value<int>();
			switch (iScriptType) {
				case 0:  //Signal
					cProfile.Script = setting["Script"].ToObject<SignalSetting>();
					break;
				case 1:  //Script:
					break;
			}

			cProfile.Charts = setting["Charts"].ToObject<List<ChartSetting>>();
			cProfile.ProfileId = setting["ProfileId"].Value<string>();
			cProfile.Parameters = setting["Parameters"].ToObject<List<string>>();
			cProfile.ScriptName = setting["ScriptName"].Value<string>();
			cProfile.ScriptType = (ScriptType) Enum.Parse(typeof(ScriptType), iScriptType.ToString());
			cProfile.Window = setting["Window"].ToObject<WindowStatus>();

			return cProfile;
		}
Exemple #5
0
        internal ProfileSetting[] Import(string file)
        {
            if (File.Exists(file))
            {
                string sJSONSettings = File.ReadAllText(file, Encoding.UTF8);
                Dictionary <string, JToken> cSettings = JsonConvert.DeserializeObject <Dictionary <string, JToken> >(sJSONSettings);

                int iCount = cSettings.Count;
                if (iCount > 0)
                {
                    int iIndex = 0;
                    ProfileSetting[] cProfiles = new ProfileSetting[iCount];
                    foreach (JToken cSetting in cSettings.Values)
                    {
                        ProfileSetting cProfile = ProfileSetting.CreateProfile(cSetting);
                        cProfiles[iIndex++] = cProfile;
                        AddProfile(cProfile);
                    }
                    return(cProfiles);
                }
            }
            return(null);
        }
Exemple #6
0
        internal void Load(string name)
        {
            string sFile = string.Format("{0}{1}.profile", GlobalSettings.Paths.ProfilePath, name);

            if (File.Exists(sFile))
            {
                lock (__cProfiles) {
                    __cProfiles.Clear();
                }

                string sJSONSettings = File.ReadAllText(sFile, Encoding.UTF8);
                Dictionary <string, JToken> cSettings = JsonConvert.DeserializeObject <Dictionary <string, JToken> >(sJSONSettings);
                foreach (JToken cSetting in cSettings.Values)
                {
                    AddProfile(ProfileSetting.CreateProfile(cSetting));
                }

                if (onLoadProfile != null)
                {
                    onLoadProfile(this, EventArgs.Empty);
                }
            }
        }
Exemple #7
0
        public static ProfileSetting CreateProfile(JToken setting)
        {
            ProfileSetting cProfile    = new ProfileSetting();
            int            iScriptType = setting["ScriptType"].Value <int>();

            switch (iScriptType)
            {
            case 0:                      //Signal
                cProfile.Script = setting["Script"].ToObject <SignalSetting>();
                break;

            case 1:                      //Script:
                break;
            }

            cProfile.ChartProperty = setting["ChartProperty"].ToObject <ChartProperty>();
            cProfile.ProfileId     = setting["ProfileId"].Value <string>();
            cProfile.Parameters    = setting["Parameters"].ToObject <List <string> >();
            cProfile.ScriptName    = setting["ScriptName"].Value <string>();
            cProfile.ScriptType    = (ScriptType)Enum.Parse(typeof(ScriptType), iScriptType.ToString());
            cProfile.Window        = setting["Window"].ToObject <WindowStatus>();

            return(cProfile);
        }
Exemple #8
0
		private void btnOK_Click(object sender, EventArgs e) {
			__cProfile = new ProfileSetting();
			__cProfile.Charts = __cCharts;
			__cProfile.ProfileId = Guid.NewGuid().ToString();
			__cProfile.Script = __cScriptSetting;
			__cProfile.ScriptName = __sScriptName;
			__cProfile.ScriptType = __cScriptType;
			__cProfile.Window = new WindowStatus();

			ProfileManager.Manager.AddProfile(__cProfile);
			this.DialogResult = DialogResult.OK;
		}
Exemple #9
0
		internal void SetProfileSetting(ProfileSetting profile) {
			__cProfile = profile;
		}