Esempio n. 1
0
        /// <summary>
        /// Create empty config
        /// </summary>
        private static void _CreateConfig()
        {
            _symbologyConfig = new SymbologyConfig();
            _symbologyConfig.OrderSymbologyType = SymbologyType.CategorySymbology;

            _symbologyConfig.OrderCategories = new ObservableCollection <OrderCategory>();
            AddDefaultCategory();

            _symbologyConfig.OrderQuantities = new ObservableCollection <OrderQuantity>();
            AddDefaultQuantity();

            SaveConfig();
        }
        /// <summary>
        /// Create empty config
        /// </summary>
        private static void _CreateConfig()
        {
            _symbologyConfig = new SymbologyConfig();
            _symbologyConfig.OrderSymbologyType = SymbologyType.CategorySymbology;

            _symbologyConfig.OrderCategories = new ObservableCollection<OrderCategory>();
            AddDefaultCategory();

            _symbologyConfig.OrderQuantities = new ObservableCollection<OrderQuantity>();
            AddDefaultQuantity();

            SaveConfig();
        }
        /// <summary>
        /// Load Config 
        /// </summary>
        private static void _LoadConfig(string configText)
        {
            _symbologyConfig = null;

            DataContractSerializer ser = new DataContractSerializer(typeof(SymbologyConfig));

            if (!string.IsNullOrEmpty(configText))
            {
                MemoryStream stream = null;
                try
                {
                    stream = new MemoryStream(Encoding.UTF8.GetBytes(configText));
                    _symbologyConfig = (SymbologyConfig)ser.ReadObject(stream);
                }
                catch (Exception ex)
                {
                    Logger.Error(ex);
                }
                finally
                {
                    if (stream != null)
                        stream.Close();
                }
            }

            if (_symbologyConfig == null)
                _CreateConfig();
        }
 private static void App_ProjectClosed(object sender, EventArgs e)
 {
     _inited = false;
     _symbologyConfig = null;
 }