コード例 #1
0
        public string CreateColumnDataSaveLine(string data_separator)
        {
            //we want
            //  col-data;col-id=20_fa;col-title=Fall 2020;col-subtitle=;col-pos=0

            Debug.WriteLine("CreateColumnDataSaveLine");

            string return_data_line;
            string data_line_start = "col-data";


            return_data_line = data_line_start;


            foreach (string cur_data_parameter in Parameter_Names)
            {
                //should be like this
                // Parameter_Names = { "Col_ProjectName", "ColID", "ColTitle", "ColSubtitle", "ColPosition" };
                // Parameter_Save_Names = { "", "col-id", "col-title", "col-subtitle", "col-pos" };

                //this one is skipped
                if (cur_data_parameter == "Col_ProjectName")
                {
                    continue;
                }


                string cur_data_addition = "";

                string cur_data_save_name = Parameter_Save_Names[Parameter_Names.IndexOf(cur_data_parameter)];
                string data_val           = "";

                switch (cur_data_parameter)
                {
                case "ColID":
                    data_val = ColID.ToString();
                    break;

                case "ColTitle":
                    data_val = ColTitle.ToString();
                    break;

                case "ColSubtitle":
                    data_val = ColSubtitle.ToString();
                    break;

                case "ColPosition":
                    data_val = ColPosition.ToString();
                    break;
                }

                cur_data_addition = string.Format("{0}={1}", cur_data_save_name, data_val);

                return_data_line += data_separator + cur_data_addition;
            }

            return(return_data_line);
        }
コード例 #2
0
        public void PrintColumnDataValues()
        {
            Debug.WriteLine("\nColumnData class paramters:");


            List <string> param_names = new List <string> {
                "Col_ProjectName", "ColID", "ColTitle", "ColSubtitle", "ColPosition"
            };


            foreach (string cur_param_name in param_names)
            {
                bool basic_formatting = false;
                bool list_formatting  = false;

                string     cur_param_val = "";
                List <int> cur_param_lst = new List <int>();

                switch (cur_param_name)
                {
                case "Col_ProjectName":
                    cur_param_val    = Col_ProjectName.ToString();
                    basic_formatting = true;
                    break;

                case "ColID":
                    cur_param_val    = ColID.ToString();
                    basic_formatting = true;
                    break;

                case "ColTitle":
                    cur_param_val    = ColTitle.ToString();
                    basic_formatting = true;
                    break;

                case "ColSubtitle":
                    cur_param_val    = ColSubtitle.ToString();
                    basic_formatting = true;
                    break;

                case "ColPosition":
                    cur_param_val    = ColPosition.ToString();
                    basic_formatting = true;
                    break;
                }

                if (basic_formatting)
                {
                    Debug.WriteLine(string.Format("    {0,-18} = {1}", cur_param_name, cur_param_val));
                }
                if (list_formatting)
                {
                    Debug.Write(string.Format("    {0,-18} = ", cur_param_name));

                    foreach (int cur_val in cur_param_lst)
                    {
                        Debug.Write(string.Format("{0} ", cur_val.ToString()));
                    }
                    Debug.WriteLine("");
                }
            }
            Debug.WriteLine("");
        }