Esempio n. 1
0
 public void SaveModelsList()
 {
     try
     {
         // Serialize
         XmlSerializer serializer = new XmlSerializer(typeof(Models), ModelTypes);
         FileStream    fs         = new FileStream(XmlModelsFile, FileMode.Create);
         serializer.Serialize(fs, this);
         fs.Close();
     }
     catch (Exception e)
     {
         LogDirector.DoAction(4, e);
     }
 }
Esempio n. 2
0
 public static Models LoadModelsList(Models Current)
 {
     try
     {
         // Deserialize
         FileStream    fs         = new FileStream(Current.XmlModelsFile, FileMode.Open);
         XmlSerializer serializer = new XmlSerializer(typeof(Models), Current.ModelTypes);
         Current = (Models)serializer.Deserialize(fs);
         fs.Close();
         return(Current);
     }
     catch (Exception e)
     {
         LogDirector.DoAction(4, e);
         return(Current);
     }
 }
Esempio n. 3
0
        public void GetTableData(O2GTable table, IO2GTableListener listener,
                                 O2GRow row, O2GTableManager mTblMgr)
        {
            try
            {
                table.subscribeUpdate(O2GTableUpdateType.Insert, listener);
                table.subscribeUpdate(O2GTableUpdateType.Update, listener);
                try
                {
                    mTblMgr.lockUpdates();
                    for (int ii = 0; ii < table.Count; ii++)
                    {
                        row = table.getGenericRow(ii);

                        foreach (O2GTableColumn CurrentColumn in table.Columns)
                        {
                            for (int jj = 0; jj < row.Columns.Count; jj++)
                            {
                                if (CurrentColumn.ID == row.Columns[jj].ID)
                                {
                                    dataGridView.Rows[ii].Cells[CurrentColumn.ID].Value = row.getCell(jj);
                                }
                            }
                        }
                    }
                }
                finally
                {
                    mTblMgr.unlockUpdates();
                }

                table.unsubscribeUpdate(O2GTableUpdateType.Insert, listener);
                table.unsubscribeUpdate(O2GTableUpdateType.Update, listener);
            }
            catch (Exception e)
            {
                LogDirector.DoAction(4, e);
            }
        }