예제 #1
0
 public EventNode toEventNode(EventTemplate et)
 {
     if (et != null)
     {
         EventNode en = new EventNode();
         en.name    = et.filename + "-" + et.name;
         en.value   = Util.toStringArray1D(ref et.columns);
         en.iconKey = et.imageKey;
         return(en);
     }
     return(null);
 }
예제 #2
0
        private Hashtable genEventTemplates(String subfile)
        {
            Hashtable ret  = new Hashtable();
            String    path = Application.StartupPath + "\\events\\" + subfile;

            try
            {
                if (System.IO.File.Exists(path))
                {
                    string[] lines = File.ReadAllLines(path);
                    for (int j = 0; j < lines.Length; j++)
                    {
                        string line = lines[j].Trim();
                        if (!lines[j].StartsWith("#"))
                        {
                            string[]      columns = line.Split(new char[] { '|' });
                            EventTemplate et      = new EventTemplate(subfile, columns);
                            javax.microedition.lcdui.Image icon = (javax.microedition.lcdui.Image)Images[et.imageKey];
                            if (icon == null && et.imageKey.Length > 0)
                            {
                                try
                                {
                                    icon = new javax.microedition.lcdui.Image(
                                        Image.FromFile(Application.StartupPath + "\\events\\" + et.imageKey)
                                        );
                                    imageList1.Images.Add(et.imageKey, icon.dimg);
                                }
                                catch (Exception err)
                                {
                                }
                            }
                            et.icon      = icon;
                            ret[et.name] = et;
                        }
                        else
                        {
                            // this line is comment
                        }
                    }
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message + "\n" + path);
            }
            return(ret);
        }