Example #1
0
        private bool IsDisposed = false; // To detect redundant calls

        public void Dispose()
        {
            if (KlonsTableAdapterManager?.TUSERSTableAdapter?.Connection != null)
            {
                KlonsTableAdapterManager.TUSERSTableAdapter.Connection.StateChange -= Connection_StateChange;
            }
            _KlonsData = null;
            IsDisposed = true;
        }
Example #2
0
 public static void ResetInstance()
 {
     if (_KlonsData == null)
     {
         _KlonsData.Dispose();
         _KlonsData = null;
     }
     _KlonsData       = new KlonsData();
     _KlonsDataModule = _KlonsData;
 }
Example #3
0
        private KlonsData()
        {
            _KlonsData   = this;
            CurrentDBTag = null;

            LoadSettings();
            LoadMasterList();

            ColorThemeHelper.MyToolStripRenderer.SetColorTheme(Settings.ColorTheme);

            if (Settings.MasterEntry.Name != "")
            {
                var me = MasterList.GetMasterEntryByName(Settings.MasterEntry.Name);
                if (me != null)
                {
                    Settings.MasterEntry.CopyFrom(me);
                }
            }

            _Params = new KlonsParams();

            ReportHelper = new ReportHelperP();

            _klonsDataSetHelper = new DataSetHelper(
                typeof(KlonsPDataSet),
                typeof(KlonsAdapters.TableAdapterManager),
                typeof(KlonsAdapters.QueriesTableAdapter),
                "ConnectionString1",
                KlonsP.Properties.Settings.Default);

            _dataSetHelpers["KlonsData"] = _klonsDataSetHelper;

            _klonsRepDataSetHelper = new DataSetHelper(
                typeof(KlonsPRepDataSet),
                typeof(KlonsRepAdapters.TableAdapterManager),
                null,
                "ConnectionString1",
                KlonsP.Properties.Settings.Default);

            _dataSetHelpers["KlonsRep"] = _klonsRepDataSetHelper;
        }