Пример #1
0
            public void Save(SerializeSession obj)
            {
                IFormatter formatter = new BinaryFormatter();
                Stream     stream    = new FileStream(@"data.bin", FileMode.Create, FileAccess.Write, FileShare.None);

                formatter.Serialize(stream, obj);
                stream.Close();
            }
Пример #2
0
            public SerializeSession Load()
            {
                Stream           stream    = new FileStream("data.bin", FileMode.Open, FileAccess.Read, FileShare.None);
                IFormatter       formatter = new BinaryFormatter();
                SerializeSession items     = (SerializeSession)formatter.Deserialize(stream);

                stream.Close();

                return(items);
            }
Пример #3
0
        /*public class txtControls : _Default
         * {
         *  public TextBox txtBoxRef { get { return TextBox1; } set { //TextBox1 = value; } }
         * }*/
        public object returnControl(string id, string t, Type type, int x, int y)
        {
            /*
             * record for next postback
             */
            //sessDict.serializeViewState(id,t,text,x,y);
            SerializeSession ss = new SerializeSession();

            /*ss.args[0] = id;
             * ss.args[1] = t;
             * ss.args[2] = "text in control";
             * ss.args[3] = x;
             * ss.args[4] = y;*/

            if (t == "Button")
            {
                Button o = new Button();
                o.ID = id;
                o.Attributes.Add("style", "Z-INDEX: 100; LEFT: " + y + "px; POSITION: absolute; TOP: " + x + "px");
                o.Text = "cntl text";
                //o.Click += new EventHandler();
                o.EnableViewState = true;
                ss.go();
                return(o);
            }
            if (t == "TextBox")
            {
                if (id == "TextBox2")
                {
                    // txtControls tx = new txtControls();
                    //TextBox txtbox = tx.txtBoxRef;
                    //txtbox.Text = "it worked";
                    //txtbox.ID = "TextBox2";
                    //return txtbox;
                }
                else
                {
                    return(null);
                }
            }
            if (t == "CheckBox")
            {
                CheckBox o = new CheckBox();
                o.Attributes.Add("style", "Z-INDEX: 100; LEFT: " + y + "px; POSITION: absolute; TOP: " + x + "px");
                o.Text = "";
                return(o);
            }
            return(null);
        }