コード例 #1
0
        public override void OnNavigatedTo()
        {
            Debug.WriteLine($"{nameof(ThemeListViewModel)} - {nameof(OnNavigatedTo)}");
            Themes.Clear();

            var tmp = ThemeRepository.GetAll();

            foreach (var item in tmp)
            {
                Themes.Add(item);
            }

            // Print all the values to the screen to debug
            //foreach (var item in AccessTokenRepository.GetAll())
            //{
            //    Debug.WriteLine($"Access Tokens: {item.Path} - {item.AccessTokenType} | {item.AccessToken}");
            //}
            //foreach (var item in ThemeRepository.GetAll())
            //{
            //    Debug.WriteLine($"Theme: {item.Name}");
            //}
            //foreach (var item in DirectoryRepository.GetAll())
            //{
            //    Debug.WriteLine($"Directories: {item.Path}");
            //}
        }
コード例 #2
0
        public void ProcessExecute()
        {
            Themes.Clear();
            int nRet = Engine.PrepareText(TextToAnalyse);

            if (nRet == 0)
            {
                // Get themes
                List <SalienceTheme> myThemes = Engine.GetDocumentThemes(String.Empty);
                foreach (SalienceTheme aTheme in myThemes)
                {
                    Themes.Add(new Theme(aTheme.sNormalizedTheme, aTheme.fScore, aTheme.nThemeType, aTheme.fSentiment, aTheme.nEvidence));
                }

                // Get named entities
                List <SalienceEntity> myEntities = Engine.GetNamedEntities(String.Empty);
                foreach (SalienceEntity anEntity in myEntities)
                {
                    NamedEntities.Add(new NamedEntity(anEntity.sNormalizedForm, anEntity.sType, anEntity.fSentimentScore, anEntity.nEvidence, anEntity.nCount));
                }

                // Get summary
                SalienceSummary mySummary = Engine.GetSummary(3, String.Empty);
                Summary.SummaryText = mySummary.sSummary;
            }
            else
            {
                // there was an error, in which case this needs to be handled somehow
            }
        }
コード例 #3
0
ファイル: Config.cs プロジェクト: diogoaguiar/card-match
        private void LoadThemes()
        {
            string json = Properties.Settings.Default.themes;

            Themes.Clear();
            Themes.AddRange(JsonConvert.DeserializeObject <List <Theme> >(json));
        }
コード例 #4
0
ファイル: ThemeManager.cs プロジェクト: chandrachivukula/hue
        public async Task LoadThemesFromCacheAsync()
        {
            Themes.Clear();

            StorageFolder themeFolder = await ApplicationData.Current.LocalFolder.CreateFolderAsync("Themes", CreationCollisionOption.OpenIfExists);

            IReadOnlyList <StorageFile> themeFiles = await themeFolder.GetFilesAsync();

            if (themeFiles.Count == 0)
            {
                await CreateDefaultThemesAsync(themeFolder);
            }
            else
            {
                foreach (var file in themeFiles)
                {
                    Debug.WriteLine(file.Name);
                    HueTheme theme = await LoadThemeFromFile(file);

                    if (theme != null)
                    {
                        Themes.Add(theme);
                    }
                }
            }


            return;
        }
コード例 #5
0
ファイル: AppViewModel.cs プロジェクト: ygrenier/Phraseur
 public void LoadThemes()
 {
     var themes = repository.GetAllThemes();
     SelectedTheme = null;
     Themes.Clear();
     foreach (var kv in themes.OrderBy(t => t.Value))
     {
         Themes.Add(new ThemeInfos
         {
             Title = kv.Value,
             File = kv.Key
         });
     }
     SelectedTheme = Themes.FirstOrDefault();
 }
コード例 #6
0
        private void ExecuteGameThemeCommand(string strTheme)
        {
            App.SetTheme(strTheme.ToUpper());

            Debug.WriteLine(_gameThemeCommand.DisplayText);
            Debug.WriteLine("Theme={" + strTheme + "}");

            //This code may seem odd byt it causes the Converter to Get Called
            // Without the correct theme Item never gets checked
            Themes.Clear();

            String[] l = (String[])App.Current.FindResource("Themes");
            foreach (String s in l)
            {
                Themes.Add(s);
            }
        }
コード例 #7
0
        /// <summary>
        ///  This Constructor is called everytime to ensure consistency.
        ///  This Constructor should be the one called DIRECTLY by all Test Harness applications.
        ///  Allows you to call with your own IDialogService or Adornment that will not leave a Dialog or
        ///  Message box on the Screen.
        /// </summary>
        /// <param name="iDlg"> </param>
        /// <param name="iSnd"></param>
        public SweeperViewModel(IDialogService iDlg, IAdornGameWithSounds iSnd)
        {
            if (System.Windows.Application.Current.MainWindow == null)
            {
                soundAdornment = new NullSoundAdornment();  // Turn off Sounds in Designer
            }
            else
            {
                soundAdornment = iSnd;
            }
            dialogService = iDlg;
            tmr           = new Timer(1000);
            tmr.Elapsed  += tmr_Elapsed;
            //Although this is Static it is ok because the two objects have the same lifetimes
            RelayCommand.NewCommandItemEvent += RelayCommand_NewCommandItemEvent;
            if (System.Windows.Application.Current.MainWindow == null)
            {
                NewGame();
            }
            App.ChangeThemeEvent += App_ChangeThemeEvent;
            //UndoRedoView urv = new UndoRedoView();
            RelayCommand.RefreshStacksEvent += RelayCommand_RefreshStacksEvent;
            //App.SetTheme("CHOCALATE");
            Themes.Clear();
            String [] l = (String [])App.Current.FindResource("Themes");
            foreach (String s in l)
            {
                Themes.Add(s);
            }
            String[] gt = (String[])App.Current.FindResource("GameTypes");
            foreach (String s in gt)
            {
                GameTypes.Add(s);
            }


            UrVm.RefreshCommand = RefreshStacksCommand;
            UrVm.RedoCommand    = this.RedoAllOrLastCommand;
            UrVm.UndoCommand    = this.UndoAllOrLastCommand;
            //UrV.DataContext = UrVm;
        }
コード例 #8
0
        private void CheckForThemes()
        {
            try
            {
                var currentThemeParser =
                    new TextFieldParser(new FileStream("Theme\\theme.csv", FileMode.Open, FileAccess.Read,
                                                       FileShare.Read));

                currentThemeParser.SetDelimiters(",");

                // go through header
                currentThemeParser.ReadLine();

                CurrentTheme = GetThemeModel(currentThemeParser.ReadFields());
                OnPropertyChanged("CurrentTheme");

                currentThemeParser.Close();

                HasCurrentTheme = true;
                OnPropertyChanged("HasCurrentTheme");
            }
            catch
            {
                HasCurrentTheme = false;
                OnPropertyChanged("HasCurrentTheme");
            }

            try
            {
                var resp = browser.GetResponse(Constants.ThemeIndexUrl);
                if (resp == null)
                {
                    return;
                }

                var parser = new TextFieldParser(new StringReader(resp))
                {
                    TextFieldType = FieldType.Delimited
                };

                parser.SetDelimiters(",");

                // go through header
                parser.ReadLine();

                Dispatcher.BeginInvoke((Action)(() => Themes.Clear()));
                while (!parser.EndOfData)
                {
                    var row   = parser.ReadFields();
                    var model = GetThemeModel(row);

                    if (HasCurrentTheme && model.Name == CurrentTheme.Name && model.Version == CurrentTheme.Version)
                    {
                        continue;
                    }

                    Dispatcher.BeginInvoke((Action)(() => Themes.Add(model)));
                }

                parser.Close();
            }
            catch (WebException)
            {
            }
        }
コード例 #9
0
 public void ClearExecute()
 {
     InputText = String.Empty;
     Themes.Clear();
 }
コード例 #10
0
 public override void ResetViewModel()
 {
     Themes.Clear();
 }
コード例 #11
0
        /// <summary>
        ///  This Constructor is called everytime to ensure consistency.
        ///  This Constructor should be the one called DIRECTLY by all Test Harness applications.
        ///  Allows you to call with your own IDialogService or Adornment that will not leave a Dialog or
        ///  Message box on the Screen.
        /// </summary>
        /// <param name="iDlg"> </param>
        /// <param name="iSnd"></param>
        public SweeperViewModel(IDialogService iDlg, IAdornGameWithSounds iSnd)
        {
            if (Application.Current == null || Application.Current.MainWindow == null)
            {
                soundAdornment = new NullSoundAdornment();  // Turn off Sounds in Designer
            }
            else
            {
                soundAdornment = iSnd;
            }
            dialogService = iDlg;
            tmr           = new Timer(1000);
            tmr.Elapsed  += tmr_Elapsed;
            //Although this is Static it is ok because the two objects have the same lifetimes
            RelayCommand.NewCommandItemEvent += RelayCommand_NewCommandItemEvent;
            // if (System.Windows.Application.Current.MainWindow == null)
            NewGame();
            App.ChangeThemeEvent += App_ChangeThemeEvent;

            RelayCommand.RefreshStacksEvent += RelayCommand_RefreshStacksEvent;

            Themes.Clear();
            var sep = new char[] { ';' };
            //String [] l = (String [])App.Current.FindResource("Themes");

            var themesStr = "Chocalate;Copper;Default;KeyWest;Powder";



            var l = themesStr.Split(sep);

            if (l == null || l.Count() == 0)
            {
                l = (String[])App.Current.FindResource("Themes");
            }

            foreach (String s in l)
            {
                Themes.Add(s);
            }

            var gameTypesStr = "Beginner;Intermediate;Advanced;Custom";
            var gt           = gameTypesStr.Split(sep);

            if (gt == null || gt.Count() == 0)
            {
                gt = (String[])App.Current.FindResource("GameTypes");
            }
            foreach (String s in gt)
            {
                GameTypes.Add(s);
            }


            UrVm.RefreshCommand = RefreshStacksCommand;
            UrVm.RedoCommand    = this.RedoAllOrLastCommand;
            UrVm.UndoCommand    = this.UndoAllOrLastCommand;
            //UrV.DataContext = UrVm;
            if (svm == null)
            {
                svm = this;
            }
        }