public void Save <T>(IList <T> persons, SaveDelegate <T> save)
 {
     foreach (T person in persons)
     {
         Console.WriteLine(save(person));
     }
 }
Exemple #2
0
 public ArticuloView(object id)
     : base(WindowType.Toplevel)
 {
     articulo=ArticuloPersister.Load(id);
     init();
     save=ArticuloPersister.Update;
 }
Exemple #3
0
 public ArticuloView(object id) : base(WindowType.Toplevel)
 {
     this.id = id;
     load();
     init();
     save = update;
 }
Exemple #4
0
 public CategoriaView(object id) : base(Gtk.WindowType.Toplevel)
 {
     this.id = id;
     load();
     init();
     save = update;
 }
            /// <summary>
            /// Initializes a new instance of the <see cref="InnerPlugin{T}" /> class.
            /// </summary>
            /// <param name="openDelegate">Open method delegate.</param>
            /// <param name="saveDelegate">Save method delegate.</param>
            public InnerPlugin(OpenDelegate <string, T> openDelegate, SaveDelegate <string, T> saveDelegate)
            {
                this._openDelegate = openDelegate;
                this._saveDelegate = saveDelegate;

                this.ConfigObjectType = typeof(T);
            }
Exemple #6
0
 public ArticuloView()
     : base(Gtk.WindowType.Toplevel)
 {
     articulo = new Articulo ();
     init ();
     save=ArticuloPersister.Insert;
 }
Exemple #7
0
//        public static void SaveSum(uint siteNum, uint sensorNum, double dataSum,DateTime time)
//        {
//            MySqlConnection connection = new MySqlConnection();
//            connection.ConnectionString = connString;
//            connection.Open();
//            MySqlCommand cmd = connection.CreateCommand();
//            cmd.CommandText = @"INSERT INTO datas_day (num_site,num_sensor,data_sum,data_avg,data_count,time_create,time_update)
//                                VALUES('?site','?sensor','?_data_sum','?_data_avg','?_data_count','?curr_day','?curr');";
//            cmd.Parameters.Add("?site", MySqlDbType.Int32).Value = siteNum;
//            cmd.Parameters.Add("?sensor", MySqlDbType.Int32).Value = sensorNum;
//            cmd.Parameters.Add("?_data_sum", MySqlDbType.Double).Value = dataSum;
//            cmd.Parameters.Add("?_data_avg", MySqlDbType.Double).Value = dataSum;
//            cmd.Parameters.Add("?_data_count", MySqlDbType.Double).Value = 1;
//            cmd.Parameters.Add("?curr_day", MySqlDbType.Double).Value = time;
//            cmd.Parameters.Add("?curr", MySqlDbType.DateTime).Value = time;
//        }

        public static void SaveAsync(uint siteNum, uint sensorNum, double dataOrigion, double data, double dataSum, double weight, DateTime time)
        {
            SaveDelegate sd = new SaveDelegate(Save);

            //sd.BeginInvoke(siteNum, sensorNum, data, weight,time, null, sd);
            sd.Invoke(siteNum, sensorNum, dataOrigion, data, dataSum, weight, time);
        }
Exemple #8
0
 public CategoriaView(object id)
     : base(Gtk.WindowType.Toplevel)
 {
     this.id = id;
     load();
     init();
     save = update;
 }
Exemple #9
0
 public ArticuloView(object id)
     : base(WindowType.Toplevel)
 {
     this.id = id;
     load();
     init ();
     save = update;
 }
        /// <summary>
        /// Add configuration editor plugin.
        /// </summary>
        /// <typeparam name="T">Type of configuration object.</typeparam>
        /// <param name="openDelegate">How to get configuration object from a file.</param>
        /// <param name="saveDelegate">How to save configuration object to a file.</param>
        /// <param name="configEditorPluginName">IWinFormConfigEditorPlugin PluginName.</param>
        public void AddPlugin <T>(OpenDelegate <string, T> openDelegate, SaveDelegate <string, T> saveDelegate, string configEditorPluginName = null)
        {
            IWinFormConfigEditorPlugin configEditorPlugin = new InnerPlugin <T>(openDelegate, saveDelegate);

            configEditorPlugin.PluginName = configEditorPluginName;
            this._configEditorPluginList.Add(configEditorPlugin);
            this.toolStripComboBoxConfigEditorPlugin.Items.Add(configEditorPlugin.PluginName);
            this.toolStripComboBoxConfigEditorPlugin.SelectedIndex = this._configEditorPluginList.IndexOf(configEditorPlugin);
        }
Exemple #11
0
        public static void Mainw()
        {
            Subject      sub          = new Subject();
            SaveDelegate savedelegate = sub.SaveCourse;

            savedelegate += Student.SaveStudent;
            savedelegate();
            Console.WriteLine("===============");
            savedelegate -= Student.SaveStudent;
            savedelegate();
        }
Exemple #12
0
        public static void Mainyt()
        {
            Subjects           sub          = new Subjects();
            SaveDelegate <int> savedelegate = sub.SaveCourse;

            savedelegate += Students.SaveStudent;
            var data = new Data
            {
                Title = "Testing data"
            };

            savedelegate(data);
            Console.WriteLine("===============");
            savedelegate -= Students.SaveStudent;
            savedelegate(data);
        }
Exemple #13
0
        public FileEditor(string title, string content, SaveDelegate save = null)
        {
            InitializeComponent();

            try
            {
                this.Text       = title;
                txtContent.Text = content;
                btnSave.Visible = save != null;
                Save            = save;
                InitEvent();
            }
            catch (Exception ex)
            {
                Logger.WriteEx2LogFile(ex);
            }
        }
        public RenameDialog(string name, SaveDelegate save)
        {
            Save = save;
            InitializeComponent();

            try
            {
                txtName.Text     = name;
                btnSave.Click   += btnSave_Click;
                btnCancel.Click += btnCancel_Click;
                txtName.KeyDown += RenameDialog_KeyDown;
            }
            catch (Exception ex)
            {
                Logger.WriteEx2LogFile(ex);
            }
        }
Exemple #15
0
 public ArticuloView()
     : base(Gtk.WindowType.Toplevel)
 {
     init ();
     save = insert;
 }
Exemple #16
0
 public CategoriaView()
     : base(Gtk.WindowType.Toplevel)
 {
     init();
     save = insert;
 }
Exemple #17
0
 /// <summary>
 /// Invoke all registered Save methods.
 /// </summary>
 public void SaveAll(bool suppressException = true)
 {
     SaveDelegate?.Invoke(suppressException);
 }
Exemple #18
0
 public CategoriaView() : base(Gtk.WindowType.Toplevel)
 {
     init();
     save = insert;
 }
Exemple #19
0
 public ArticuloView() : base(Gtk.WindowType.Toplevel)
 {
     articulo = new Articulo();
     init();
     save = ArticuloPersister.Insert;
 }
Exemple #20
0
 public ArticuloView(object id) : base(WindowType.Toplevel)
 {
     articulo = ArticuloPersister.Load(id);
     init();
     save = ArticuloPersister.Update;
 }
Exemple #21
0
 public ArticuloView() : base(Gtk.WindowType.Toplevel)
 {
     init();
     save = insert;
 }