コード例 #1
0
        private void OpenFile_Button(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openfileDialog = new OpenFileDialog();

            openfileDialog.Filter = "JSON Files (*.json)|*.json";

            if (openfileDialog.ShowDialog() == true)
            {
                RadioButtons.Visibility = Visibility.Visible;
                custIDs.Clear();

                fullPath = openfileDialog.FileName;
                currDir  = Path.GetDirectoryName(fullPath);
                fileName = Path.GetFileNameWithoutExtension(fullPath);

                ReadJsonFromFile(fullPath);

                JObject outer = PopulateClientIDs();
                //properties
                JObject inner = fileContentToken[DEFAULT_CLIENT].Value <JObject>();

                clients    = outer.Properties().Select(p => p.Name).ToList();
                properties = inner.Properties().Select(p => p.Name).ToList();

                StkJSONProperties.Children.Clear();
                foreach (string p in properties)
                {
                    JSONProperty prop = new JSONProperty();
                    prop.property.Content = p;
                    StkJSONProperties.Children.Add(prop);
                }
                PopulateLeftSide(DEFAULT_CLIENT);
                startingLangCode = translator.Detect(fileContentObject[DEFAULT_CLIENT].ToString());
            }
        }
コード例 #2
0
        private void ReloadCurrentLottery(string currLotteryName)
        {
            //reload saved values
            ReadJsonFromFile(fullPath);

            JObject outer = fileContentToken.Value <JObject>();

            //JObject inner = fileContentToken[DEFAULT_CLIENT].Value<JObject>();

            clients = outer.Properties().Select(p => p.Name).ToList();
            //properties = inner.Properties().Select(p => p.Name).ToList();

            StkJSONProperties.Children.Clear();
            foreach (string p in properties)
            {
                JSONProperty prop = new JSONProperty();
                prop.property.Content = p;
                StkJSONProperties.Children.Add(prop);
            }
            ClientChanged(currLotteryName);
            string languageTest = "";

            foreach (string p in properties)
            {
                languageTest += fileContentObject[DEFAULT_CLIENT][p] + "\n";
            }
            startingLangCode = translator.Detect(languageTest);
        }