Пример #1
0
        public static bool GetCAOInfo(out TSDictionary info, bool includeCountries = true, bool includeAddOns = true, bool openOnly = false)
        {
            info = new TSDictionary();

            try
            {
                List <Country> caos = new List <Country>();
                if (includeCountries)
                {
                    caos.AddRange(CountryAdministrator.GetCountries());
                }
                if (includeAddOns)
                {
                    caos.AddRange(CountryAdministrator.GetAddOns());
                }

                Dictionary <string, EM_UI_MainForm> openMainForms = new Dictionary <string, EM_UI_MainForm>();
                foreach (EM_UI_MainForm mf in EM_AppContext.Instance.GetOpenCountriesMainForms())
                {
                    openMainForms.Add(mf.GetCountryShortName().ToLower(), mf);
                }

                List <Form>   mainForms        = new List <Form>();
                List <string> shortNames       = new List <string>();
                List <string> longNames        = new List <string>();
                List <bool>   isAddOn          = new List <bool>();
                List <bool>   isOpen           = new List <bool>();
                List <string> mainXMLFileNames = new List <string>();
                List <string> dataXMLFileNames = new List <string>();
                List <string> filePaths        = new List <string>();
                foreach (Country cao in caos)
                {
                    bool open = openMainForms.ContainsKey(cao._shortName.ToLower());
                    if (openOnly && !open)
                    {
                        continue;
                    }
                    mainForms.Add(open ? openMainForms[cao._shortName.ToLower()] : null);
                    shortNames.Add(cao._shortName);
                    // long name is only availabel through CountryConfig (it doesn't seem appropriate to open the country just to get the long-name)
                    longNames.Add(open ? openMainForms[cao._shortName.ToLower()].GetCountryLongName() : cao._shortName);
                    isAddOn.Add(cao._isAddOn);
                    isOpen.Add(open);
                    mainXMLFileNames.Add(CountryAdministrator.GetCountryFileName(cao._shortName));
                    dataXMLFileNames.Add(cao._isAddOn ? string.Empty : CountryAdministrator.GetDataFileName(cao._shortName));
                    filePaths.Add(CountryAdministrator.GetCountryPath(cao._shortName));
                }
                info.SetItem(UISessionInfo.CAO_INFO_MainForms, mainForms);
                info.SetItem(UISessionInfo.CAO_INFO_ShortNames, shortNames);
                info.SetItem(UISessionInfo.CAO_INFO_LongNames, longNames);
                info.SetItem(UISessionInfo.CAO_INFO_IsAddOn, isAddOn);
                info.SetItem(UISessionInfo.CAO_INFO_IsOpen, isOpen);
                info.SetItem(UISessionInfo.CAO_INFO_MainXMLFileNames, mainXMLFileNames);
                info.SetItem(UISessionInfo.CAO_INFO_DataXMLFileNames, dataXMLFileNames);
                info.SetItem(UISessionInfo.CAO_INFO_FilePaths, filePaths);
                return(true);
            }
            catch { return(false); }
        }
Пример #2
0
 public static void SetSessionUserSettings(string plugInUserSettingsId, TSDictionary settings)
 {
     CallUIFunction <string>("SetSessionUserSettings", new Dictionary <string, object>()
     {
         { "plugInUserSettingsId", plugInUserSettingsId },
         { "settings", settings }
     });
 }
Пример #3
0
 public static void SetSessionUserSettings(string plugInUserSettingsId, TSDictionary settings)
 {
     if (EM_AppContext.Instance._sessionUserSettings.ContainsKey(plugInUserSettingsId))
     {
         EM_AppContext.Instance._sessionUserSettings.Remove(plugInUserSettingsId);
     }
     EM_AppContext.Instance._sessionUserSettings.Add(plugInUserSettingsId, settings);
 }
Пример #4
0
 public MolapAggregationsStorage(T cubeid, StorageConfig config, MolapCellValuesHelper <T, U> cellValuesHelper, CanonicFormater <T> canonicFormater)
 {
     _rootCubeid        = cubeid;
     _config            = config;
     _cellValuesHelper  = cellValuesHelper;
     _canonicFormater   = canonicFormater;
     _keyHandler        = new MolapKeyHandler <T>(config.MolapConfig);
     _aggregationGraphs = new TSDictionary <T, Graph <T, U> >();
 }
        public T GetValue <T>(string id)
        {
            TSDictionary values = GetValues();

            if (!values.ContainsKey(id))
            {
                throw new Exception("Not existing key: " + id);
            }
            return(values.GetItem <T>(id));
        }
        public TSDictionary GetValues()
        {
            TSDictionary values = new TSDictionary();

            foreach (Item item in Items)
            {
                values.SetItem(item.Id, item.textBox.Text);
            }
            return(values);
        }
        private void SelectDefaultTemplateComboForm_Load(object sender, EventArgs e)
        {
            if (givenTemplateName != null || givenTemplate != null)
            {
                btnOK_Click(null, null);
            }

            // Preload default templates into combobox
            if (Directory.Exists(EnvironmentInfo.GetUserSelectableTemplateFolder()))
            {
                // Try reading only the brand templates
                string[] allTemplates = Directory.GetFiles(EnvironmentInfo.GetUserSelectableTemplateFolder(), DefGeneral.BRAND_NAME + "*.xml");
                // If no brand-specific template is found, load all available templates
                if (allTemplates.Length == 0)
                {
                    allTemplates = Directory.GetFiles(EnvironmentInfo.GetUserSelectableTemplateFolder(), "*.xml");
                }

                // try to retieve last selected template from session info
                TSDictionary pluginSessionInfo    = UISessionInfo.GetSessionUserSettings(StatisticsPresenter.USER_SETTINGS_ID);
                string       lastSelectedTemplate = pluginSessionInfo != null && pluginSessionInfo.ContainsKey(StatisticsPresenter.LAST_SELECTED_TEMPLATE)
                    ? pluginSessionInfo.GetItem <string>(StatisticsPresenter.LAST_SELECTED_TEMPLATE) : null;

                int selectedIndex = 0;
                foreach (string templatePath in allTemplates)
                {
                    if (XML_handling.ParseTemplateInfo(templatePath, out Template.TemplateInfo templateInfo, out ErrorCollector errorCollector))
                    {
                        comboBox1.Items.Add(new TemplateItem(templateInfo.name, templatePath));
                        if (templateInfo.name == lastSelectedTemplate)
                        {
                            selectedIndex = comboBox1.Items.Count - 1;
                        }
                    }
                }
                if (comboBox1.Items.Count > 0)
                {
                    comboBox1.SelectedIndex = selectedIndex;
                }
            }
            else
            {
                MessageBox.Show("The default template folder was not found!");
            }
        }
Пример #8
0
        public static bool GetCAOInfo(out TSDictionary info,
                                      bool includeCountries = true, bool includeAddOns = true, bool openOnly = false)
        {
            info = new TSDictionary();
            TSDictionary parameters = UICommunicator.ComposeParameters("includeCountries", includeCountries,
                                                                       "includeAddOns", includeAddOns,
                                                                       "openOnly", openOnly);

            if (UICommunicator.CallStaticFunction(CLASS_NAME_UISessionInfo, "GetCAOInfo", out TSObject retVal, out string errMsg, parameters))
            {
                if (retVal.GetValue <bool>() == true)
                {
                    info = parameters.GetItem <TSDictionary>("info");
                }
                return(retVal.GetValue <bool>());
            }
            MessageBox.Show(errMsg); return(false);
        }
Пример #9
0
 public DataSourceCollection()
 {
     _innerdict = new TSDictionary <string, IDataSource>();
 }
Пример #10
0
 public NodeCollection()
 {
     _innerdict = new TSDictionary <T, Node <T, U> >();
 }
 public MolapValuesCollection()
 {
     _innerdict = new TSDictionary <T, ValueType>();
 }
        private void btnOK_Click(object sender, System.EventArgs e)
        {
            if (!LoadTemplateInfo())
            {
                return;
            }

            Visible = false;

            if (givenFilePackages == null)
            {
                SelectFilePackages();
            }
            else
            {
                filePackages = givenFilePackages; DialogResult = DialogResult.OK;
            }

            if (givenUserInput != null)
            {
                userInput = givenUserInput;
            }
            else if (DialogResult != DialogResult.Cancel && templateInfo.GetUserVariables().Count != 0)
            {
                TakeUserInput takeUserInput = new TakeUserInput(templateInfo);
                takeUserInput.ShowDialog();
                userInput    = takeUserInput.userVariables;
                DialogResult = takeUserInput.DialogResult;
            }

            // if all done, fully parse the selected template
            if (DialogResult == DialogResult.OK)
            {
                if (givenTemplate != null)
                {
                    template = givenTemplate;
                }
                else if (templatePath != "")
                {
                    if (!XML_handling.ParseTemplate(templatePath, out template, out ErrorCollector errorCollector))
                    {
                        DialogResult = DialogResult.Cancel;
                    }
                    if (errorCollector.HasErrors())
                    {
                        MessageBox.Show(errorCollector.GetErrorMessage());
                    }
                }
                else
                {
                    MessageBox.Show("Error! no template or templatepath given!");
                    DialogResult = DialogResult.Cancel;
                }
                if (template != null)
                {
                    template.info = templateInfo;
                }
            }

            if (sender != null && template != null && template.info != null && template.info.name != null)
            {
                // save selected template in session info
                TSDictionary pluginSessionInfo = new TSDictionary();
                pluginSessionInfo.SetItem(StatisticsPresenter.LAST_SELECTED_TEMPLATE, template.info.name);
                UISessionInfo.SetSessionUserSettings(StatisticsPresenter.USER_SETTINGS_ID, pluginSessionInfo);
            }

            Close();
        }
Пример #13
0
 protected void Init()
 {
     _index = new TSDictionary <string, T>();
     _items = new TSDictionary <T, IDataItem <T> >();
 }
 protected virtual void Init()
 {
     _innerDictionary = new TSDictionary <T, TMember>();
     _mapName         = new TSDictionary <string, T>();
 }