Наследование: MonoBehaviour
Пример #1
0
 public virtual void Inform(ResourceLoader loader)
 {
     if (wordFiles != null)
     {
         words = GetWordSet(loader, wordFiles, ignoreCase);
     }
 }
        //It creates Stream or XmlReader
        public override object GetEntity(Uri absoluteUri, string role, Type ofObjectToReturn)
        {
            Stream stream;

              IResourceGetter resourceLoader = new ResourceLoader(_resourceAssembly);

              //if is file compiled with assembly
              if (absoluteUri.Scheme == "resource")
              {
            string xslText = (string)resourceLoader.GetObject(absoluteUri.AbsolutePath);

            stream = new MemoryStream(Encoding.UTF8.GetBytes(xslText));
              }
              //in other cases read file from specified absolute Uri
              else
              {
            stream = (Stream)base.GetEntity(absoluteUri, role, typeof(Stream));
              }

              //what type to return
              if (ofObjectToReturn == typeof(XmlReader))
            return XmlReader.Create(stream);
              else
            return stream;
        }
	  // TODO: this should use inputstreams from the loader, not File!
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void inform(org.apache.lucene.analysis.util.ResourceLoader loader) throws java.io.IOException
	  public virtual void inform(ResourceLoader loader)
	  {
		if (mapping != null)
		{
		  IList<string> wlist = null;
		  File mappingFile = new File(mapping);
		  if (mappingFile.exists())
		  {
			wlist = getLines(loader, mapping);
		  }
		  else
		  {
			IList<string> files = splitFileNames(mapping);
			wlist = new List<>();
			foreach (string file in files)
			{
			  IList<string> lines = getLines(loader, file.Trim());
			  wlist.AddRange(lines);
			}
		  }
		  NormalizeCharMap.Builder builder = new NormalizeCharMap.Builder();
		  parseRules(wlist, builder);
		  normMap = builder.build();
		  if (normMap.map == null)
		  {
			// if the inner FST is null, it means it accepts nothing (e.g. the file is empty)
			// so just set the whole map to null
			normMap = null;
		  }
		}
	  }
	  public void inform(ResourceLoader loader)
	  {
		TokenizerFactory factory = tokenizerFactory == null ? null : loadTokenizerFactory(loader, tokenizerFactory);

		Analyzer analyzer = new AnalyzerAnonymousInnerClassHelper(this, factory);

		try
		{
		  string formatClass = format;
		  if (format == null || format.Equals("solr"))
		  {
			formatClass = typeof(SolrSynonymParser).Name;
		  }
		  else if (format.Equals("wordnet"))
		  {
			formatClass = typeof(WordnetSynonymParser).Name;
		  }
		  // TODO: expose dedup as a parameter?
		  map = loadSynonyms(loader, formatClass, true, analyzer);
		}
		catch (ParseException e)
		{
		  throw new IOException("Error parsing synonyms file:", e);
		}
	  }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void inform(org.apache.lucene.analysis.util.ResourceLoader loader) throws java.io.IOException
	  public virtual void inform(ResourceLoader loader)
	  {
		string[] dicts = dictionaryFiles.Split(",", true);

		InputStream affix = null;
		IList<InputStream> dictionaries = new List<InputStream>();

		try
		{
		  dictionaries = new List<>();
		  foreach (string file in dicts)
		  {
			dictionaries.Add(loader.openResource(file));
		  }
		  affix = loader.openResource(affixFile);

		  this.dictionary = new Dictionary(affix, dictionaries, ignoreCase);
		}
		catch (ParseException e)
		{
		  throw new IOException("Unable to load hunspell data! [dictionary=" + dictionaries + ",affix=" + affixFile + "]", e);
		}
		finally
		{
		  IOUtils.closeWhileHandlingException(affix);
		  IOUtils.closeWhileHandlingException(dictionaries);
		}
	  }
        static internal int checkDelegate(IntPtr l,int p,out ResourceLoader.LoadResDoneCallback ua) {
            int op = extractFunction(l,p);
			if(LuaDLL.lua_isnil(l,p)) {
				ua=null;
				return op;
			}
            else if (LuaDLL.lua_isuserdata(l, p)==1)
            {
                ua = (ResourceLoader.LoadResDoneCallback)checkObj(l, p);
                return op;
            }
            LuaDelegate ld;
            checkType(l, -1, out ld);
            if(ld.d!=null)
            {
                ua = (ResourceLoader.LoadResDoneCallback)ld.d;
                return op;
            }
			LuaDLL.lua_pop(l,1);
			
			l = LuaState.get(l).L;
            ua = (string a1,UnityEngine.Object a2) =>
            {
                int error = pushTry(l);

				pushValue(l,a1);
				pushValue(l,a2);
				ld.pcall(2, error);
				LuaDLL.lua_settop(l, error-1);
			};
			ld.d=ua;
			return op;
		}
Пример #7
0
        public static async Task<GLShader> FromResource(string vertexResource, string fragmentResource, IGraphicsBackend graphics = null)
		{
            graphics = graphics ?? Hooks.GraphicsBackend;
			ResourceLoader loader = new ResourceLoader ();
			string vertexSource = await getSource(vertexResource, loader);
			string fragmentSource = await getSource(fragmentResource, loader);
            return FromText(vertexSource, fragmentSource, graphics);
		}
Пример #8
0
        public override void Init(ResourceLoader loader, EntitySetting template)
        {
            base.Init(loader, template);

            MonsterEntitySetting setting = template as MonsterEntitySetting;
            AttrComp.MoveSpeedBase = setting.MoveSpeed;
            AttrComp.MaxHpBase = setting.MaxHp;
            AttrComp.Hp = AttrComp.MaxHp;
            AttrComp.RegisterAttrChangeCallback(AttrName.Hp, OnHpChange);
        }
Пример #9
0
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
 //ORIGINAL LINE: @Override public void inform(ResourceLoader loader) throws java.io.IOException
 public virtual void inform(ResourceLoader loader)
 {
     if (articlesFile == null)
     {
       articles = FrenchAnalyzer.DEFAULT_ARTICLES;
     }
     else
     {
       articles = getWordSet(loader, articlesFile, ignoreCase);
     }
 }
 public virtual void Inform(ResourceLoader loader)
 {
     if (wordFiles != null)
     {
         protectedWords = GetWordSet(loader, wordFiles, ignoreCase);
     }
     if (stringPattern != null)
     {
         pattern = ignoreCase ? Pattern.compile(stringPattern, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE) : Pattern.compile(stringPattern);
     }
 }
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
 //ORIGINAL LINE: private void assertClasspathDelegation(ResourceLoader rl) throws Exception
 private void assertClasspathDelegation(ResourceLoader rl)
 {
     // try a stopwords file from classpath
     CharArraySet set = WordlistLoader.getSnowballWordSet(new System.IO.StreamReader(rl.openResource("org/apache/lucene/analysis/snowball/english_stop.txt"), Encoding.UTF8), TEST_VERSION_CURRENT);
     assertTrue(set.contains("you"));
     // try to load a class; we use string comparison because classloader may be different...
     //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
     assertEquals("org.apache.lucene.analysis.util.RollingCharBuffer", rl.newInstance("org.apache.lucene.analysis.util.RollingCharBuffer", typeof(object)).GetType().FullName);
     // theoretically classes should also be loadable:
     IOUtils.closeWhileHandlingException(rl.openResource("java/lang/String.class"));
 }
        public void LoadResource_WhenFolderContainsASingleTestFile_ThenReturns1ItemList()
        {
            //ARRANGE
            CleanupTestFolder("EmptyResources.data");
            var resourceLoader = new ResourceLoader(TestFolder);

            //ACT
            var resources = resourceLoader.LoadResource();

            //ASSERT
            Assert.Equal(1, resources.Count());
        }
        public void LoadResource_WhenFolderContainsManyTestFilesAndOtherFiles_ThenReturnsCorrectNumberList()
        {
            //ARRANGE
            CleanupTestFolder("EmptyResources.data", "ManyResources.data", "OneResource.data", "TextFile1.txt", "TextFile2.txt");
            var resourceLoader = new ResourceLoader(TestFolder);

            //ACT
            var resources = resourceLoader.LoadResource();

            //ASSERT
            Assert.Equal(3, resources.Count());
        }
Пример #14
0
        public override void Init(ResourceLoader loader, EntitySetting template)
        {
            base.Init(loader, template);

            AtkComp = AddComp<AtkComp>();

            TowerEntitySetting setting = (TowerEntitySetting)template;
            AttrComp.AtkBase = setting.Atk;
            AttrComp.AtkSpeedBase = setting.AtkSpeed;
            AttrComp.AtkRangeBase = setting.AtkRange;
            AttrComp.AtkTypes.AddRange(setting.AtkTypeArr);
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void inform(ResourceLoader loader) throws java.io.IOException
	  public void inform(ResourceLoader loader)
	  {
		TokenizerFactory tokFactory = null;
		if (tf != null)
		{
		  tokFactory = loadTokenizerFactory(loader, tf);
		}

		IEnumerable<string> wlist = loadRules(synonyms, loader);

		synMap = new SlowSynonymMap(ignoreCase);
		parseRules(wlist, synMap, "=>", ",", expand,tokFactory);
	  }
 public virtual void Inform(ResourceLoader loader)
 {
     if (commonWordFiles != null)
     {
         if ("snowball".Equals(format, StringComparison.CurrentCultureIgnoreCase))
         {
             commonWords = getSnowballWordSet(loader, commonWordFiles, ignoreCase);
         }
         else
         {
             commonWords = GetWordSet(loader, commonWordFiles, ignoreCase);
         }
     }
     else
     {
         commonWords = StopAnalyzer.ENGLISH_STOP_WORDS_SET;
     }
 }
 public virtual void Inform(ResourceLoader loader)
 {
     if (encoderClass.Equals("float"))
     {
         encoder = new FloatEncoder();
     }
     else if (encoderClass.Equals("integer"))
     {
         encoder = new IntegerEncoder();
     }
     else if (encoderClass.Equals("identity"))
     {
         encoder = new IdentityEncoder();
     }
     else
     {
         encoder = loader.NewInstance(encoderClass, typeof(PayloadEncoder));
     }
 }
 public virtual void Inform(ResourceLoader loader)
 {
     if (dictionaryFiles != null)
     {
         assureMatchVersion();
         IList<string> files = splitFileNames(dictionaryFiles);
         if (files.Count > 0)
         {
             StemmerOverrideFilter.Builder builder = new StemmerOverrideFilter.Builder(ignoreCase);
             foreach (string file in files)
             {
                 IList<string> list = getLines(loader, file.Trim());
                 foreach (string line in list)
                 {
                     string[] mapping = line.Split("\t", 2);
                     builder.add(mapping[0], mapping[1]);
                 }
             }
             dictionary = builder.build();
         }
     }
 }
	  public virtual void Inform(ResourceLoader loader)
	  {
		InputStream stream = null;
		try
		{
		  if (dictFile != null) // the dictionary can be empty.
		  {
			dictionary = getWordSet(loader, dictFile, false);
		  }
		  // TODO: Broken, because we cannot resolve real system id
		  // ResourceLoader should also supply method like ClassLoader to get resource URL
		  stream = loader.openResource(hypFile);
		  InputSource @is = new InputSource(stream);
		  @is.Encoding = encoding; // if it's null let xml parser decide
		  @is.SystemId = hypFile;
		  hyphenator = HyphenationCompoundWordTokenFilter.getHyphenationTree(@is);
		}
		finally
		{
		  IOUtils.closeWhileHandlingException(stream);
		}
	  }
Пример #20
0
        internal void Init(ResourceLoader loader)
        {
            MapRoot = gameObject.transform;
            CellRoot = new GameObject("CellRoot").transform;
            CellRoot.SetParent(MapRoot, false);
            PathRoot = new GameObject("PathRoot").transform;
            PathRoot.SetParent(MapRoot, false);

            Loader = loader;
            Cells = new Dictionary<int, MapCell>();
            PathColors = new List<Color>();
            PathObjectRoots = new List<GameObject>();
            Paths = new List<MapPath>();
        }
Пример #21
0
 public string GetString(string resource)
 {
     return(ResourceLoader.GetForViewIndependentUse().GetString(resource));
 }
Пример #22
0
 public OverviewSerializationTests()
 {
     overview = ResourceLoader.LoadObjectFromJson <Overview>("Overview.json", ManagementClient.Settings);
 }
Пример #23
0
 public virtual void Inform(ResourceLoader loader)
 {
     if (stopWordFiles != null)
     {
         if (FORMAT_WORDSET.Equals(format, StringComparison.CurrentCultureIgnoreCase))
         {
             stopWords = GetWordSet(loader, stopWordFiles, ignoreCase);
         }
         else if (FORMAT_SNOWBALL.Equals(format, StringComparison.CurrentCultureIgnoreCase))
         {
             stopWords = getSnowballWordSet(loader, stopWordFiles, ignoreCase);
         }
         else
         {
             throw new System.ArgumentException("Unknown 'format' specified for 'words' file: " + format);
         }
     }
     else
     {
         if (null != format)
         {
             throw new System.ArgumentException("'format' can not be specified w/o an explicit 'words' file: " + format);
         }
         stopWords = new CharArraySet(luceneMatchVersion, StopAnalyzer.ENGLISH_STOP_WORDS_SET, ignoreCase);
     }
 }
 /// <summary>
 /// Returns the resource's lines (with content treated as UTF-8)
 /// </summary>
 protected internal IList <string> getLines(ResourceLoader loader, string resource)
 {
     return(WordlistLoader.getLines(loader.openResource(resource), StandardCharsets.UTF_8));
 }
Пример #25
0
        /// <summary>
        /// Get message description from message ID
        /// </summary>
        /// <param name="messageID">
        /// messageID
        /// </param>
        /// <param name="cultureName">
        /// cultureName
        /// </param>
        /// <param name="useChildUICulture">
        /// 子カルチャを使用している場合:true<br/>
        /// use ChildUICulture : true
        /// </param>
        /// <param name="notExist">
        /// 子カルチャを使用している場合で、<br/>
        /// ファイルを発見できなかった場合はtrueを返す。<br/>
        /// if useChildUICulture == true<br/>
        /// then If the file is not found, return true.
        /// </param>
        /// <returns>
        /// メッセージ記述<br/>
        /// Get message description
        /// </returns>
        private static string GetMessageDescription(
            string messageID, string cultureName,
            bool useChildUICulture, out bool notExist)
        {
            #region local

            //bool xmlfilenotExist = false;
            notExist = false;

            string tempXMLFileName = string.Empty;
            string tempXMLFilePath = string.Empty;

            string defaultXMLFileName     = string.Empty;
            string defaultXMLFilePath     = string.Empty;
            string cultureWiseXMLFileName = string.Empty;
            string cultureWiseXMLFilePath = string.Empty;

            string cultureWiseXMLParentFileName = string.Empty;
            string cultureWiseXMLParentFilePath = string.Empty;

            bool defaultXMLFilePath_ResourceLoaderExists             = false;
            bool defaultXMLFilePath_EmbeddedResourceLoaderExists     = false;
            bool cultureWiseXMLFilePath_ResourceLoaderExists         = false;
            bool cultureWiseXMLFilePath_EmbeddedResourceLoaderExists = false;

            #endregion

            defaultXMLFilePath = GetConfigParameter.GetConfigValue(FxLiteral.XML_MSG_DEFINITION);

            GetMessage.GetCultureWiseXMLFileName(
                cultureName, defaultXMLFilePath, out defaultXMLFileName, out cultureWiseXMLFilePath, out cultureWiseXMLFileName);

            // This has been added for Threadsafe
            lock (thisLock)
            {
                #region ContainsKey

                // Check that XML file is already loaded.
                if (GetMessage.DicMSG.ContainsKey(cultureWiseXMLFileName))
                {
                    // culture wise XML file is already loaded.
                    if (GetMessage.DicMSG[cultureWiseXMLFileName].ContainsKey(messageID))
                    {
                        return(GetMessage.DicMSG[cultureWiseXMLFileName][messageID]);
                    }
                    else
                    {
                        return(string.Empty);
                    }
                }
                else
                {
                    // culture wise XML file isn't loaded.
                }

                if (GetMessage.DicMSG.ContainsKey(defaultXMLFileName))
                {
                    // default XML file is already loaded.

                    if (useChildUICulture)
                    {
                        // next, try load.
                    }
                    else
                    {
                        // default XML
                        if (DicMSG[defaultXMLFileName].ContainsKey(messageID))
                        {
                            return(GetMessage.DicMSG[defaultXMLFileName][messageID]);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                }
                else
                {
                    // default XML file isn't loaded.
                }

                #endregion

                #region FillDictionary

                // cultureWiseXMLFilePath
                if (EmbeddedResourceLoader.Exists(cultureWiseXMLFilePath, false))
                {
                    // Exists cultureWiseXMLFile
                    cultureWiseXMLFilePath_EmbeddedResourceLoaderExists = true;
                }
                else
                {
                    // not exists
                    if (ResourceLoader.Exists(cultureWiseXMLFilePath, false))
                    {
                        // Exists cultureWiseXMLFile
                        cultureWiseXMLFilePath_ResourceLoaderExists = true;
                    }
                    else
                    {
                        // not exists

                        // defaultXMLFilePath
                        if (EmbeddedResourceLoader.Exists(defaultXMLFilePath, false))
                        {
                            // Exists defaultXMLFilePath
                            defaultXMLFilePath_EmbeddedResourceLoaderExists = true;
                        }
                        else
                        {
                            if (ResourceLoader.Exists(defaultXMLFilePath, false))
                            {
                                // Exists defaultXMLFilePath
                                defaultXMLFilePath_ResourceLoaderExists = true;
                            }
                        }
                    }
                }

                // select file path
                if (cultureWiseXMLFilePath_ResourceLoaderExists ||
                    cultureWiseXMLFilePath_EmbeddedResourceLoaderExists)
                {
                    // cultureWiseXMLFile
                    tempXMLFileName = cultureWiseXMLFileName;
                    tempXMLFilePath = cultureWiseXMLFilePath;
                }
                else
                {
                    // If the file is not found,
                    if (useChildUICulture)
                    {
                        // Look for use the culture info of the parent.
                        notExist = true;
                        return(string.Empty);
                    }
                    else
                    {
                        if (defaultXMLFilePath_ResourceLoaderExists ||
                            defaultXMLFilePath_EmbeddedResourceLoaderExists)
                        {
                            // defaultXMLFilePath
                            tempXMLFileName = defaultXMLFileName;
                            tempXMLFilePath = defaultXMLFilePath;
                        }
                        else
                        {
                            // use empty XML.
                        }
                    }
                }

                // select load method.
                XmlDocument xMLMSG = new XmlDocument();
                Dictionary <string, string> innerDictionary = new Dictionary <string, string>();

                if (defaultXMLFilePath_EmbeddedResourceLoaderExists ||
                    cultureWiseXMLFilePath_EmbeddedResourceLoaderExists)
                {
                    // Use EmbeddedResourceLoader
                    xMLMSG.LoadXml(EmbeddedResourceLoader.LoadXMLAsString(tempXMLFilePath));

                    //added by ritu
                    GetMessage.FillDictionary(xMLMSG, innerDictionary);

                    // and initialize DicMSG[tempXMLFileName]
                    DicMSG[tempXMLFileName] = innerDictionary;
                }
                else if (defaultXMLFilePath_ResourceLoaderExists ||
                         cultureWiseXMLFilePath_ResourceLoaderExists)
                {
                    // Load normally.
                    xMLMSG.Load(PubCmnFunction.BuiltStringIntoEnvironmentVariable(tempXMLFilePath));

                    //added by ritu
                    GetMessage.FillDictionary(xMLMSG, innerDictionary);
                    // and initialize DicMSG[tempXMLFileName]
                    DicMSG[tempXMLFileName] = innerDictionary;
                }
                else
                {
                    // If the file is not found, initialized as empty XML
                    xMLMSG.LoadXml("<?xml version=\"1.0\" encoding=\"utf-8\" ?><MSGD></MSGD>");

                    //added by ritu
                    GetMessage.FillDictionary(xMLMSG, innerDictionary);

                    // and initialize DicMSG[tempXMLFileName]
                    DicMSG[tempXMLFileName] = innerDictionary;
                    //xmlfilenotExist = true;
                }

                // and return GetMessageDescription.
                if (DicMSG[tempXMLFileName].ContainsKey(messageID))
                {
                    return(GetMessage.DicMSG[tempXMLFileName][messageID]);
                }
                else
                {
                    return(string.Empty);
                }

                #endregion
            }
        }
Пример #26
0
        public async Task <IEnumerable <Store> > GetStoresAsync()
        {
            var json = ResourceLoader.GetEmbeddedResourceString(Assembly.Load(new AssemblyName("MyShop")), "stores.json");

            return(await Task.Run(() => JsonConvert.DeserializeObject <List <Store> >(json)));
        }
Пример #27
0
        /// <summary>
        /// init main
        /// </summary>
        public MainWindowViewModel()
        {
            RunMutex(this, null);

            try{
                dialogs = new ObservableCollection <IDialogViewModel>();
                updater = new Updater();

                updater.isUserNotified = Environment.GetCommandLineArgs().Contains <string>("IAmNotified_DoUpdate");

                runSilent = Environment.GetCommandLineArgs().Contains <string>("runSilent");
            }

            catch (Exception e) {
                LogWriter.CreateLogEntry(string.Format("{0}\n{1}", e.Message, e.InnerException != null ? e.InnerException.Message : ""));
                return;
            }

            if (!updater.isUserNotified)
            {
                settingsReaderWriter = new SettingsReaderWriter();
                dbReaderWriter       = new DatabaseReaderWriter();
            }
            else
            {
                updater.allowUpdate = true;
                firstRun            = false;

                updater.StartMonitoring();
            }

            try{
                resLoader          = new ResourceLoader();
                pipeServer         = new PipeServer();
                eventObjectHandler = new EventObjectHandler();

                tb = (TaskbarIcon)Application.Current.FindResource("TrayNotifyIcon");
            }
            catch (Exception e) {
                LogWriter.CreateLogEntry(string.Format("{0}\n{1}", e.Message, e.InnerException != null ? e.InnerException.Message : ""));
            }

            mainWindowIcon = new BitmapImage();
            mainWindowIcon.BeginInit();
            mainWindowIcon.UriSource = new Uri("pack://application:,,,/EventMessenger;component/Resources/logo.ico");

            mainWindowIcon.EndInit();

            tb.IconSource = mainWindowIcon;

            //logReader = new LogFileReaderWriter(10000, true); // just for testing purposes

            _cmdDeleteEntry    = new RelayCommand(DeleteRow);
            _cmdAddNewEvent    = new RelayCommand(AddNewEvent);
            _cmdAddNewResponse = new RelayCommand(AddNewResponse);

            rowContextMenuItems        = new ObservableCollection <MenuItem>();
            emptySpaceContextMenuItems = new ObservableCollection <MenuItem>();

            emptySpaceContextMenuItems.Add(new MenuItem()
            {
                Header  = resLoader.getResource("contextMenuItemAddNewEvent"),
                Command = _cmdAddNewEvent
            });

            rowContextMenuItems.Add(new MenuItem()
            {
                Header  = resLoader.getResource("contextMenuItemAddOrEditResponse"),
                Command = _cmdAddNewResponse
            });
            rowContextMenuItems.Add(new MenuItem()
            {
                Header = resLoader.getResource("contextMenuItemEditEvent"),
                //ToolTip = "this will be the helptext",
                Command = _cmdAddNewEvent
            });

            rowContextMenuItems.Add(new MenuItem()
            {
                Header  = resLoader.getResource("contextMenuItemDeleteSelectedItem"),
                Command = _cmdDeleteEntry
            });

            //dataGridSource = new ObservableCollection<EventObjectModel>();

            Application.Current.MainWindow.Closing   += new CancelEventHandler(CloseThreads);
            Application.Current.MainWindow.Activated += new EventHandler(LoadCompleted);
            updater.newVersionAvailable += new EventHandler(AskForUpdateNow);
            tb.TrayLeftMouseDown        += new RoutedEventHandler(RestoreMainWindow);
            tb.MouseDown += new MouseButtonEventHandler(RestoreMainWindow);
            //any dialog boxes added in the constructor won't appear until DialogBehavior.DialogViewModels gets bound to the Dialogs collection.
        }
Пример #28
0
        /// <summary>
        /// Loads stream items from the souncloud api
        /// </summary>
        /// <param name="count">The amount of items to load</param>
        // ReSharper disable once RedundantAssignment
        public IAsyncOperation <LoadMoreItemsResult> LoadMoreItemsAsync(uint count)
        {
            // Return a task that will get the items
            return(Task.Run(async() =>
            {
                // We are loading
                await DispatcherHelper.ExecuteOnUIThreadAsync(() => { App.IsLoading = true; });

                // Get the resource loader
                var resources = ResourceLoader.GetForViewIndependentUse();

                // Check if the user is not logged in
                if (User != null)
                {
                    try
                    {
                        // Get the like tracks
                        var likeTracks = await SoundByteService.Current.GetAsync <TrackListHolder>($"/users/{User.Id}/favorites", new Dictionary <string, string>
                        {
                            { "limit", "50" },
                            { "cursor", Token },
                            { "linked_partitioning", "1" }
                        });

                        // Parse uri for offset
                        var param = new QueryParameterCollection(likeTracks.NextList);
                        var cursor = param.FirstOrDefault(x => x.Key == "cursor").Value;

                        // Get the likes cursor
                        Token = string.IsNullOrEmpty(cursor) ? "eol" : cursor;

                        // Make sure that there are tracks in the list
                        if (likeTracks.Tracks.Count > 0)
                        {
                            // Set the count variable
                            count = (uint)likeTracks.Tracks.Count;

                            // Loop though all the tracks on the UI thread
                            await DispatcherHelper.ExecuteOnUIThreadAsync(() =>
                            {
                                likeTracks.Tracks.ForEach(Add);
                            });
                        }
                        else
                        {
                            // There are no items, so we added no items
                            count = 0;

                            // Reset the token
                            Token = "eol";

                            // No items tell the user
                            await DispatcherHelper.ExecuteOnUIThreadAsync(async() =>
                            {
                                await new MessageDialog(resources.GetString("LikeTracks_Content"), resources.GetString("LikeTracks_Header")).ShowAsync();
                            });
                        }
                    }
                    catch (SoundByteException ex)
                    {
                        // Exception, most likely did not add any new items
                        count = 0;

                        // Exception, display error to the user
                        await DispatcherHelper.ExecuteOnUIThreadAsync(async() =>
                        {
                            await new MessageDialog(ex.ErrorDescription, ex.ErrorTitle).ShowAsync();
                        });
                    }
                }
                else
                {
                    // Not logged in, so no new items
                    count = 0;

                    // Reset the token
                    Token = "eol";

                    await DispatcherHelper.ExecuteOnUIThreadAsync(async() =>
                    {
                        await new MessageDialog(resources.GetString("ErrorControl_LoginFalse_Content"), resources.GetString("ErrorControl_LoginFalse_Header")).ShowAsync();
                    });
                }

                // We are not loading
                await DispatcherHelper.ExecuteOnUIThreadAsync(() => { App.IsLoading = false; });

                // Return the result
                return new LoadMoreItemsResult {
                    Count = count
                };
            }).AsAsyncOperation());
        }
Пример #29
0
        private void InitializeComponent()
        {
            if (ResourceLoader.CanProvideContentFor(new ResourceLoader.ResourceLoadingQuery
            {
                AssemblyName = typeof(PopupPage).GetTypeInfo().Assembly.GetName(),
                ResourcePath = "Views/PopupPage.xaml",
                Instance = this
            }))
            {
                __InitComponentRuntime();
                return;
            }
            if (XamlLoader.XamlFileProvider != null && XamlLoader.XamlFileProvider(GetType()) != null)
            {
                __InitComponentRuntime();
                return;
            }
            StaticResourceExtension staticResourceExtension = new StaticResourceExtension();
            BindingExtension        bindingExtension        = new BindingExtension();
            BindingExtension        bindingExtension2       = new BindingExtension();
            Image                   image                    = new Image();
            BindingExtension        bindingExtension3        = new BindingExtension();
            BindingExtension        bindingExtension4        = new BindingExtension();
            Image                   image2                   = new Image();
            BindingExtension        bindingExtension5        = new BindingExtension();
            BindingExtension        bindingExtension6        = new BindingExtension();
            StaticResourceExtension staticResourceExtension2 = new StaticResourceExtension();
            StaticResourceExtension staticResourceExtension3 = new StaticResourceExtension();
            Label                   label                    = new Label();
            BindingExtension        bindingExtension7        = new BindingExtension();
            ImageButton             imageButton              = new ImageButton();
            FlexLayout              flexLayout               = new FlexLayout();
            StaticResourceExtension staticResourceExtension4 = new StaticResourceExtension();
            StaticResourceExtension staticResourceExtension5 = new StaticResourceExtension();
            Label                   label2                   = new Label();
            BindingExtension        bindingExtension8        = new BindingExtension();
            BindingExtension        bindingExtension9        = new BindingExtension();
            StaticResourceExtension staticResourceExtension6 = new StaticResourceExtension();
            StaticResourceExtension staticResourceExtension7 = new StaticResourceExtension();
            Label                   label3                   = new Label();
            FlexLayout              flexLayout2              = new FlexLayout();
            PopupPage               popupPage;
            NameScope               nameScope = (NameScope)(NameScope.GetNameScope(popupPage = this) ?? new NameScope());

            NameScope.SetNameScope(popupPage, nameScope);
            popupPage.SetValue(FlexLayout.DirectionProperty, new FlexDirectionTypeConverter().ConvertFromInvariantString("Column"));
            popupPage.SetValue(FlexLayout.AlignItemsProperty, new FlexAlignItemsTypeConverter().ConvertFromInvariantString("Stretch"));
            popupPage.SetValue(FlexLayout.JustifyContentProperty, new FlexJustifyTypeConverter().ConvertFromInvariantString("Start"));
            staticResourceExtension.Key = "LightGrayColor";
            XamlServiceProvider xamlServiceProvider = new XamlServiceProvider();
            Type typeFromHandle = typeof(IProvideValueTarget);

            object[] array = new object[0 + 1];
            array[0] = popupPage;
            object service;

            xamlServiceProvider.Add(typeFromHandle, service = new SimpleValueTargetProvider(array, VisualElement.BackgroundColorProperty, nameScope));
            xamlServiceProvider.Add(typeof(IReferenceProvider), service);
            Type typeFromHandle2 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver = new XmlNamespaceResolver();

            xmlNamespaceResolver.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xamlServiceProvider.Add(typeFromHandle2, new XamlTypeResolver(xmlNamespaceResolver, typeof(PopupPage).GetTypeInfo().Assembly));
            xamlServiceProvider.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(8, 13)));
            object obj = ((IMarkupExtension)staticResourceExtension).ProvideValue((IServiceProvider)xamlServiceProvider);

            popupPage.BackgroundColor = (Color)obj;
            VisualDiagnostics.RegisterSourceInfo(obj, new Uri("Views\\PopupPage.xaml", UriKind.RelativeOrAbsolute), 8, 13);
            flexLayout.SetValue(FlexLayout.DirectionProperty, new FlexDirectionTypeConverter().ConvertFromInvariantString("Row"));
            flexLayout.SetValue(FlexLayout.AlignItemsProperty, new FlexAlignItemsTypeConverter().ConvertFromInvariantString("Center"));
            flexLayout.SetValue(FlexLayout.JustifyContentProperty, new FlexJustifyTypeConverter().ConvertFromInvariantString("SpaceBetween"));
            flexLayout.SetValue(FlexLayout.BasisProperty, new FlexBasis.FlexBasisTypeConverter().ConvertFromInvariantString("70"));
            flexLayout.SetValue(FlexLayout.ShrinkProperty, 0f);
            flexLayout.SetValue(VisualElement.BackgroundColorProperty, Color.White);
            image.SetValue(VisualElement.HeightRequestProperty, 25.0);
            image.SetValue(Image.AspectProperty, Aspect.AspectFit);
            image.SetValue(View.MarginProperty, new Thickness(20.0, 0.0, 0.0, 0.0));
            bindingExtension.Path = "SelectedVehicule";
            BindingBase binding = ((IMarkupExtension <BindingBase>)bindingExtension).ProvideValue((IServiceProvider)null);

            image.SetBinding(BindableObject.BindingContextProperty, binding);
            bindingExtension2.Path = "ModeImagePath";
            BindingBase binding2 = ((IMarkupExtension <BindingBase>)bindingExtension2).ProvideValue((IServiceProvider)null);

            image.SetBinding(Image.SourceProperty, binding2);
            flexLayout.Children.Add(image);
            VisualDiagnostics.RegisterSourceInfo(image, new Uri("Views\\PopupPage.xaml", UriKind.RelativeOrAbsolute), 15, 10);
            image2.SetValue(VisualElement.HeightRequestProperty, 25.0);
            image2.SetValue(Image.AspectProperty, Aspect.AspectFit);
            image2.SetValue(View.MarginProperty, new Thickness(2.0, 0.0, 0.0, 0.0));
            bindingExtension3.Path = "SelectedVehicule";
            BindingBase binding3 = ((IMarkupExtension <BindingBase>)bindingExtension3).ProvideValue((IServiceProvider)null);

            image2.SetBinding(BindableObject.BindingContextProperty, binding3);
            bindingExtension4.Path = "LigneImagePath";
            BindingBase binding4 = ((IMarkupExtension <BindingBase>)bindingExtension4).ProvideValue((IServiceProvider)null);

            image2.SetBinding(Image.SourceProperty, binding4);
            flexLayout.Children.Add(image2);
            VisualDiagnostics.RegisterSourceInfo(image2, new Uri("Views\\PopupPage.xaml", UriKind.RelativeOrAbsolute), 20, 10);
            bindingExtension5.Path = "SelectedVehicule";
            BindingBase binding5 = ((IMarkupExtension <BindingBase>)bindingExtension5).ProvideValue((IServiceProvider)null);

            label.SetBinding(BindableObject.BindingContextProperty, binding5);
            bindingExtension6.Path = "Destination";
            BindingBase binding6 = ((IMarkupExtension <BindingBase>)bindingExtension6).ProvideValue((IServiceProvider)null);

            label.SetBinding(Label.TextProperty, binding6);
            staticResourceExtension2.Key = "DarkGrayColor";
            XamlServiceProvider xamlServiceProvider2 = new XamlServiceProvider();
            Type typeFromHandle3 = typeof(IProvideValueTarget);

            object[] array2 = new object[0 + 3];
            array2[0] = label;
            array2[1] = flexLayout;
            array2[2] = popupPage;
            object service2;

            xamlServiceProvider2.Add(typeFromHandle3, service2 = new SimpleValueTargetProvider(array2, Label.TextColorProperty, nameScope));
            xamlServiceProvider2.Add(typeof(IReferenceProvider), service2);
            Type typeFromHandle4 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver2 = new XmlNamespaceResolver();

            xmlNamespaceResolver2.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver2.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xamlServiceProvider2.Add(typeFromHandle4, new XamlTypeResolver(xmlNamespaceResolver2, typeof(PopupPage).GetTypeInfo().Assembly));
            xamlServiceProvider2.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(27, 16)));
            object obj2 = ((IMarkupExtension)staticResourceExtension2).ProvideValue((IServiceProvider)xamlServiceProvider2);

            label.TextColor = (Color)obj2;
            VisualDiagnostics.RegisterSourceInfo(obj2, new Uri("Views\\PopupPage.xaml", UriKind.RelativeOrAbsolute), 27, 16);
            staticResourceExtension3.Key = "TCLRegular";
            XamlServiceProvider xamlServiceProvider3 = new XamlServiceProvider();
            Type typeFromHandle5 = typeof(IProvideValueTarget);

            object[] array3 = new object[0 + 3];
            array3[0] = label;
            array3[1] = flexLayout;
            array3[2] = popupPage;
            object service3;

            xamlServiceProvider3.Add(typeFromHandle5, service3 = new SimpleValueTargetProvider(array3, Label.FontFamilyProperty, nameScope));
            xamlServiceProvider3.Add(typeof(IReferenceProvider), service3);
            Type typeFromHandle6 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver3 = new XmlNamespaceResolver();

            xmlNamespaceResolver3.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver3.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xamlServiceProvider3.Add(typeFromHandle6, new XamlTypeResolver(xmlNamespaceResolver3, typeof(PopupPage).GetTypeInfo().Assembly));
            xamlServiceProvider3.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(28, 16)));
            object target = label.FontFamily = (string)((IMarkupExtension)staticResourceExtension3).ProvideValue((IServiceProvider)xamlServiceProvider3);

            VisualDiagnostics.RegisterSourceInfo(target, new Uri("Views\\PopupPage.xaml", UriKind.RelativeOrAbsolute), 28, 16);
            BindableProperty    fontSizeProperty     = Label.FontSizeProperty;
            FontSizeConverter   fontSizeConverter    = new FontSizeConverter();
            XamlServiceProvider xamlServiceProvider4 = new XamlServiceProvider();
            Type typeFromHandle7 = typeof(IProvideValueTarget);

            object[] array4 = new object[0 + 3];
            array4[0] = label;
            array4[1] = flexLayout;
            array4[2] = popupPage;
            object service4;

            xamlServiceProvider4.Add(typeFromHandle7, service4 = new SimpleValueTargetProvider(array4, Label.FontSizeProperty, nameScope));
            xamlServiceProvider4.Add(typeof(IReferenceProvider), service4);
            Type typeFromHandle8 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver4 = new XmlNamespaceResolver();

            xmlNamespaceResolver4.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver4.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xamlServiceProvider4.Add(typeFromHandle8, new XamlTypeResolver(xmlNamespaceResolver4, typeof(PopupPage).GetTypeInfo().Assembly));
            xamlServiceProvider4.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(29, 16)));
            label.SetValue(fontSizeProperty, ((IExtendedTypeConverter)fontSizeConverter).ConvertFromInvariantString("Default", (IServiceProvider)xamlServiceProvider4));
            label.SetValue(Label.LineBreakModeProperty, LineBreakMode.TailTruncation);
            label.SetValue(View.MarginProperty, new Thickness(5.0, 0.0, 0.0, 0.0));
            label.SetValue(FlexLayout.GrowProperty, 1f);
            flexLayout.Children.Add(label);
            VisualDiagnostics.RegisterSourceInfo(label, new Uri("Views\\PopupPage.xaml", UriKind.RelativeOrAbsolute), 25, 10);
            imageButton.SetValue(VisualElement.HeightRequestProperty, 20.0);
            imageButton.SetValue(View.MarginProperty, new Thickness(20.0, 0.0));
            imageButton.SetValue(ImageButton.AspectProperty, Aspect.AspectFit);
            imageButton.SetValue(ImageButton.SourceProperty, new ImageSourceConverter().ConvertFromInvariantString("close.png"));
            imageButton.SetValue(VisualElement.BackgroundColorProperty, Color.White);
            bindingExtension7.Path = "ClosePopupTapCommand";
            BindingBase binding7 = ((IMarkupExtension <BindingBase>)bindingExtension7).ProvideValue((IServiceProvider)null);

            imageButton.SetBinding(ImageButton.CommandProperty, binding7);
            flexLayout.Children.Add(imageButton);
            VisualDiagnostics.RegisterSourceInfo(imageButton, new Uri("Views\\PopupPage.xaml", UriKind.RelativeOrAbsolute), 33, 10);
            popupPage.Children.Add(flexLayout);
            VisualDiagnostics.RegisterSourceInfo(flexLayout, new Uri("Views\\PopupPage.xaml", UriKind.RelativeOrAbsolute), 9, 6);
            flexLayout2.SetValue(FlexLayout.DirectionProperty, new FlexDirectionTypeConverter().ConvertFromInvariantString("Column"));
            flexLayout2.SetValue(FlexLayout.AlignItemsProperty, new FlexAlignItemsTypeConverter().ConvertFromInvariantString("Start"));
            flexLayout2.SetValue(FlexLayout.JustifyContentProperty, new FlexJustifyTypeConverter().ConvertFromInvariantString("Start"));
            flexLayout2.SetValue(FlexLayout.GrowProperty, 1f);
            label2.SetValue(Label.TextProperty, "Prochain arrêt : ");
            staticResourceExtension4.Key = "DarkGrayColor";
            XamlServiceProvider xamlServiceProvider5 = new XamlServiceProvider();
            Type typeFromHandle9 = typeof(IProvideValueTarget);

            object[] array5 = new object[0 + 3];
            array5[0] = label2;
            array5[1] = flexLayout2;
            array5[2] = popupPage;
            object service5;

            xamlServiceProvider5.Add(typeFromHandle9, service5 = new SimpleValueTargetProvider(array5, Label.TextColorProperty, nameScope));
            xamlServiceProvider5.Add(typeof(IReferenceProvider), service5);
            Type typeFromHandle10 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver5 = new XmlNamespaceResolver();

            xmlNamespaceResolver5.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver5.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xamlServiceProvider5.Add(typeFromHandle10, new XamlTypeResolver(xmlNamespaceResolver5, typeof(PopupPage).GetTypeInfo().Assembly));
            xamlServiceProvider5.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(45, 16)));
            object obj3 = ((IMarkupExtension)staticResourceExtension4).ProvideValue((IServiceProvider)xamlServiceProvider5);

            label2.TextColor = (Color)obj3;
            VisualDiagnostics.RegisterSourceInfo(obj3, new Uri("Views\\PopupPage.xaml", UriKind.RelativeOrAbsolute), 45, 16);
            staticResourceExtension5.Key = "TCLLight";
            XamlServiceProvider xamlServiceProvider6 = new XamlServiceProvider();
            Type typeFromHandle11 = typeof(IProvideValueTarget);

            object[] array6 = new object[0 + 3];
            array6[0] = label2;
            array6[1] = flexLayout2;
            array6[2] = popupPage;
            object service6;

            xamlServiceProvider6.Add(typeFromHandle11, service6 = new SimpleValueTargetProvider(array6, Label.FontFamilyProperty, nameScope));
            xamlServiceProvider6.Add(typeof(IReferenceProvider), service6);
            Type typeFromHandle12 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver6 = new XmlNamespaceResolver();

            xmlNamespaceResolver6.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver6.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xamlServiceProvider6.Add(typeFromHandle12, new XamlTypeResolver(xmlNamespaceResolver6, typeof(PopupPage).GetTypeInfo().Assembly));
            xamlServiceProvider6.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(46, 16)));
            object target2 = label2.FontFamily = (string)((IMarkupExtension)staticResourceExtension5).ProvideValue((IServiceProvider)xamlServiceProvider6);

            VisualDiagnostics.RegisterSourceInfo(target2, new Uri("Views\\PopupPage.xaml", UriKind.RelativeOrAbsolute), 46, 16);
            BindableProperty    fontSizeProperty2    = Label.FontSizeProperty;
            FontSizeConverter   fontSizeConverter2   = new FontSizeConverter();
            XamlServiceProvider xamlServiceProvider7 = new XamlServiceProvider();
            Type typeFromHandle13 = typeof(IProvideValueTarget);

            object[] array7 = new object[0 + 3];
            array7[0] = label2;
            array7[1] = flexLayout2;
            array7[2] = popupPage;
            object service7;

            xamlServiceProvider7.Add(typeFromHandle13, service7 = new SimpleValueTargetProvider(array7, Label.FontSizeProperty, nameScope));
            xamlServiceProvider7.Add(typeof(IReferenceProvider), service7);
            Type typeFromHandle14 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver7 = new XmlNamespaceResolver();

            xmlNamespaceResolver7.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver7.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xamlServiceProvider7.Add(typeFromHandle14, new XamlTypeResolver(xmlNamespaceResolver7, typeof(PopupPage).GetTypeInfo().Assembly));
            xamlServiceProvider7.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(47, 16)));
            label2.SetValue(fontSizeProperty2, ((IExtendedTypeConverter)fontSizeConverter2).ConvertFromInvariantString("Small", (IServiceProvider)xamlServiceProvider7));
            label2.SetValue(View.MarginProperty, new Thickness(20.0, 20.0, 0.0, 0.0));
            flexLayout2.Children.Add(label2);
            VisualDiagnostics.RegisterSourceInfo(label2, new Uri("Views\\PopupPage.xaml", UriKind.RelativeOrAbsolute), 44, 10);
            bindingExtension8.Path = "SelectedVehicule";
            BindingBase binding8 = ((IMarkupExtension <BindingBase>)bindingExtension8).ProvideValue((IServiceProvider)null);

            label3.SetBinding(BindableObject.BindingContextProperty, binding8);
            bindingExtension9.Path = "ProchainArret";
            BindingBase binding9 = ((IMarkupExtension <BindingBase>)bindingExtension9).ProvideValue((IServiceProvider)null);

            label3.SetBinding(Label.TextProperty, binding9);
            staticResourceExtension6.Key = "DarkGrayColor";
            XamlServiceProvider xamlServiceProvider8 = new XamlServiceProvider();
            Type typeFromHandle15 = typeof(IProvideValueTarget);

            object[] array8 = new object[0 + 3];
            array8[0] = label3;
            array8[1] = flexLayout2;
            array8[2] = popupPage;
            object service8;

            xamlServiceProvider8.Add(typeFromHandle15, service8 = new SimpleValueTargetProvider(array8, Label.TextColorProperty, nameScope));
            xamlServiceProvider8.Add(typeof(IReferenceProvider), service8);
            Type typeFromHandle16 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver8 = new XmlNamespaceResolver();

            xmlNamespaceResolver8.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver8.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xamlServiceProvider8.Add(typeFromHandle16, new XamlTypeResolver(xmlNamespaceResolver8, typeof(PopupPage).GetTypeInfo().Assembly));
            xamlServiceProvider8.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(51, 16)));
            object obj4 = ((IMarkupExtension)staticResourceExtension6).ProvideValue((IServiceProvider)xamlServiceProvider8);

            label3.TextColor = (Color)obj4;
            VisualDiagnostics.RegisterSourceInfo(obj4, new Uri("Views\\PopupPage.xaml", UriKind.RelativeOrAbsolute), 51, 16);
            staticResourceExtension7.Key = "TCLRegular";
            XamlServiceProvider xamlServiceProvider9 = new XamlServiceProvider();
            Type typeFromHandle17 = typeof(IProvideValueTarget);

            object[] array9 = new object[0 + 3];
            array9[0] = label3;
            array9[1] = flexLayout2;
            array9[2] = popupPage;
            object service9;

            xamlServiceProvider9.Add(typeFromHandle17, service9 = new SimpleValueTargetProvider(array9, Label.FontFamilyProperty, nameScope));
            xamlServiceProvider9.Add(typeof(IReferenceProvider), service9);
            Type typeFromHandle18 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver9 = new XmlNamespaceResolver();

            xmlNamespaceResolver9.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver9.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xamlServiceProvider9.Add(typeFromHandle18, new XamlTypeResolver(xmlNamespaceResolver9, typeof(PopupPage).GetTypeInfo().Assembly));
            xamlServiceProvider9.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(52, 16)));
            object target3 = label3.FontFamily = (string)((IMarkupExtension)staticResourceExtension7).ProvideValue((IServiceProvider)xamlServiceProvider9);

            VisualDiagnostics.RegisterSourceInfo(target3, new Uri("Views\\PopupPage.xaml", UriKind.RelativeOrAbsolute), 52, 16);
            BindableProperty    fontSizeProperty3     = Label.FontSizeProperty;
            FontSizeConverter   fontSizeConverter3    = new FontSizeConverter();
            XamlServiceProvider xamlServiceProvider10 = new XamlServiceProvider();
            Type typeFromHandle19 = typeof(IProvideValueTarget);

            object[] array10 = new object[0 + 3];
            array10[0] = label3;
            array10[1] = flexLayout2;
            array10[2] = popupPage;
            object service10;

            xamlServiceProvider10.Add(typeFromHandle19, service10 = new SimpleValueTargetProvider(array10, Label.FontSizeProperty, nameScope));
            xamlServiceProvider10.Add(typeof(IReferenceProvider), service10);
            Type typeFromHandle20 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver10 = new XmlNamespaceResolver();

            xmlNamespaceResolver10.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver10.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xamlServiceProvider10.Add(typeFromHandle20, new XamlTypeResolver(xmlNamespaceResolver10, typeof(PopupPage).GetTypeInfo().Assembly));
            xamlServiceProvider10.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(53, 16)));
            label3.SetValue(fontSizeProperty3, ((IExtendedTypeConverter)fontSizeConverter3).ConvertFromInvariantString("Medium", (IServiceProvider)xamlServiceProvider10));
            label3.SetValue(View.MarginProperty, new Thickness(20.0, 0.0, 0.0, 0.0));
            label3.SetValue(Label.LineBreakModeProperty, LineBreakMode.TailTruncation);
            flexLayout2.Children.Add(label3);
            VisualDiagnostics.RegisterSourceInfo(label3, new Uri("Views\\PopupPage.xaml", UriKind.RelativeOrAbsolute), 49, 10);
            popupPage.Children.Add(flexLayout2);
            VisualDiagnostics.RegisterSourceInfo(flexLayout2, new Uri("Views\\PopupPage.xaml", UriKind.RelativeOrAbsolute), 40, 6);
            VisualDiagnostics.RegisterSourceInfo(popupPage, new Uri("Views\\PopupPage.xaml", UriKind.RelativeOrAbsolute), 2, 2);
        }
Пример #30
0
 private WindowsRuntimeResourceManager(string baseName, Assembly assembly)
     : base(baseName, assembly)
 {
     this.resourceLoader = ResourceLoader.GetForViewIndependentUse(baseName);
 }
Пример #31
0
 public override void _Ready()
 {
     _cloudScene = (PackedScene)ResourceLoader.Load("res://Scenes/Decoration/Cloud.tscn");
 }
        //Strings
        private void ConstructStrings()
        {
            ResourceLoader resource = ResourceLoader.GetForCurrentView();

            this.Button.Title = resource.GetString("/Tools/TextArtistic");
        }
Пример #33
0
 public static string Get(string key)
 {
     return(ResourceLoader.GetForCurrentView().GetString(key));
 }
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
 //ORIGINAL LINE: private TokenizerFactory loadTokenizerFactory(ResourceLoader loader, String cname) throws java.io.IOException
 private TokenizerFactory loadTokenizerFactory(ResourceLoader loader, string cname)
 {
     Type clazz = loader.findClass(cname, typeof(TokenizerFactory));
     try
     {
       TokenizerFactory tokFactory = clazz.getConstructor(typeof(IDictionary)).newInstance(tokArgs);
       if (tokFactory is ResourceLoaderAware)
       {
     ((ResourceLoaderAware) tokFactory).inform(loader);
       }
       return tokFactory;
     }
     catch (Exception e)
     {
       throw new Exception(e);
     }
 }
Пример #35
0
 public StringProvider()
 {
     loader = new ResourceLoader();
 }
Пример #36
0
        public override Program Load(Address addrLoad)
        {
            var cfgSvc = Services.RequireService <IConfigurationService>();

            this.arch = cfgSvc.GetArchitecture("x86-protected-16");
            var rdr = new LeImageReader(RawImage, this.lfaNew);

            if (!LoadNeHeader(rdr))
            {
                throw new BadImageFormatException("Unable to read NE header.");
            }

            switch (bTargetOs)
            {
            case NE_TARGETOS.Windows:
            case NE_TARGETOS.Windows386:
                this.platform = cfgSvc.GetEnvironment("win16").Load(Services, arch);
                break;

            case NE_TARGETOS.EuropeanDos:
                this.platform = cfgSvc.GetEnvironment("ms-dos").Load(Services, arch);
                break;

            case NE_TARGETOS.Os2:
                this.platform = cfgSvc.GetEnvironment("os2-16").Load(Services, arch);
                break;

            default:
                // Not implemented
                break;
            }

            var program = new Program(
                this.segmentMap,
                arch,
                platform);

            var rsrcLoader = new ResourceLoader(RawImage, this.lfaNew + offRsrcTable, cResourceTableEntries);

            switch (bTargetOs)
            {
            case NE_TARGETOS.Windows:
            case NE_TARGETOS.Windows386:
                program.Resources.Name = "NE resources";
                if (offRsrcTable != offResidentNameTable)     // Some NE images contain no resources (indicated by offRsrcTable == offResidentNameTable)
                {
                    program.Resources.Resources.AddRange(rsrcLoader.LoadResources());
                }
                break;

            case NE_TARGETOS.Os2:
                program.Resources.Name = "OS/2 resources";
                program.Resources.Resources.AddRange(rsrcLoader.LoadOs2Resources(segments, cSeg, cbFileAlignmentShift));
                break;

            default:
                // Don´t support resources
                break;
            }

            foreach (var impRef in this.importStubs.Values)
            {
                program.ImportReferences.Add(impRef.Item1, impRef.Item2);
            }
            return(program);
        }
Пример #37
0
 public string GetLocalizedResource(string resourceName)
 => ResourceLoader.GetForCurrentView().GetString(resourceName.Replace(".", "/"));
        //Strings
        private string ConstructStrings()
        {
            ResourceLoader resource = ResourceLoader.GetForCurrentView();

            return(resource.GetString("/Layers/GeometryCapsule"));
        }
Пример #39
0
 private ResourceCache(string root)
 {
     _loader = new ResourceLoader(root);
     _cache  = new MemoryCache();
 }
        private void ShowFlyout(Message <DecoderTypes> message)
        {
            Task.Factory.StartNew(async() =>
            {
                string displayName = null;
                IMediaInformation mediaInformation = null;
                if (message.ContainsKey("StorageItemInfo"))
                {
                    var sii        = message.GetValue <StorageItemInfo>("StorageItemInfo");
                    StorageFile sf = await sii.GetStorageFileAsync();
                    if (sf != null)
                    {
                        try
                        {
                            var stream       = await sf.OpenReadAsync();
                            mediaInformation = MediaInformationFactory.CreateMediaInformationFromStream(stream);
                            displayName      = sf.DisplayName;
                        }
                        catch (Exception e)
                        {
                            System.Diagnostics.Debug.WriteLine("로컬 파일 열기 실패 : " + e.Message);
                        }
                    }
                }
                else if (message.ContainsKey("NetworkItemInfo"))
                {
                    var wdii = message.GetValue <NetworkItemInfo>("NetworkItemInfo");

                    if (message.ContainsKey("VideoStream"))
                    {
                        Stream videoStream = message.GetValue <Stream>("VideoStream");
                        mediaInformation   = MediaInformationFactory.CreateMediaInformationFromStream(videoStream.AsRandomAccessStream());
                        displayName        = wdii.Name;
                    }
                    else
                    {
                        if (wdii.Uri != null)
                        {
                            try
                            {
                                string url = wdii.Uri.AbsoluteUri;
                                Windows.Foundation.Collections.PropertySet ps = null;

                                if (message.ContainsKey("UserName"))
                                {
                                    string username = message.GetValue <string>("UserName");
                                    string password = message.GetValue <string>("Password");
                                    url             = wdii.GetAuthenticateUrl(username, password);
                                }

                                if (message.ContainsKey("CodePage"))
                                {
                                    int codepage   = message.GetValue <int>("CodePage");
                                    ps             = new Windows.Foundation.Collections.PropertySet();
                                    ps["codepage"] = codepage;
                                }

                                mediaInformation = MediaInformationFactory.CreateMediaInformationFromUri(url, ps);
                                displayName      = wdii.Name;
                            }
                            catch (Exception e)
                            {
                                System.Diagnostics.Debug.WriteLine("리모트(Uri) 파일 열기 실패 : " + e.Message);
                            }
                        }
                    }
                }

                await DispatcherHelper.RunAsync(async() =>
                {
                    MessengerInstance.Send(new Message("IsOpen", false), "ShowLoadingPanel");

                    if (mediaInformation == null)
                    {
                        System.Diagnostics.Debug.WriteLine("에러 발생.");
                        var resource = ResourceLoader.GetForCurrentView();
                        var dlg      = DialogHelper.GetSimpleContentDialog(
                            resource.GetString("Message/Error/LoadMedia"),
                            resource.GetString("Message/Error/CheckFile"),
                            resource.GetString("Button/Close/Content"));
                        await dlg.ShowAsync();
                        App.ContentDlgOp = null;
                    }
                    else
                    {
                        var btnName       = message.GetValue <string>("ButtonName");
                        _PlaybackCallback = message.Action;
                        //기본 디코더로 설정
                        mediaInformation.RecommendedDecoderType = Settings.Playback.DefaultDecoderType;
                        //선택된 정보 저장
                        mediaInformation.Title  = displayName;
                        CurrentMediaInformation = mediaInformation;

                        StorageItemCodecSource.Clear();
                        foreach (var codecGroup in CurrentMediaInformation.CodecInformationList
                                 .GroupBy(x => x.CodecType).OrderBy(x => x.Key)
                                 .Select(x => new StorageItemCodec((MediaStreamTypes)x.Key)
                        {
                            Items = new ObservableCollection <CodecInformation>(x.ToArray())
                        }))
                        {
                            StorageItemCodecSource.Add(codecGroup);
                        }
                        Views.MainPage page = (Window.Current.Content as Frame).Content as Views.MainPage;
                        var button          = ElementHelper.FindVisualChild <Button>(page, btnName);

                        //정보창 표시
                        button.Flyout.ShowAt(button);
                    }
                });
            });
        }
Пример #41
0
 public LocalizationService()
 {
     _resourceLoader = ResourceLoader.GetForCurrentView();
 }
Пример #42
0
            internal static void Postfix(KnowledgeSkillTree __instance)
            {
                knowledgeSkillTree = __instance;

                foreach (var(megaKnowledgeKey, megaKnowledge) in Main.MegaKnowledges)
                {
                    var cloneFrom = __instance.GetComponentsInChildren <Component>()
                                    .First(component => component.name == megaKnowledge.cloneFrom).gameObject;

                    var child = cloneFrom.transform.parent.FindChild(megaKnowledge.name);
                    if (child != null)
                    {
                        return;
                    }

                    var newButton = Object.Instantiate(cloneFrom, cloneFrom.transform.parent, true);
                    newButton.transform.Translate(megaKnowledge.offsetX, megaKnowledge.offsetY, 0);

                    var btn = newButton.GetComponentInChildren <KnowledgeSkillBtn>();
                    newButton.name = megaKnowledge.name;
                    var knowledgeModels = Game.instance.model.knowledgeSets.First(model => model.name == megaKnowledge.set).GetKnowledgeModels();
                    btn.ClickedEvent = new Action <KnowledgeSkillBtn>(skillBtn =>
                    {
                        var hasAll     = true;
                        var btd6Player = Game.instance.GetBtd6Player();
                        foreach (var knowledgeModel in knowledgeModels)
                        {
                            if (!btd6Player.HasKnowledge(knowledgeModel.id))
                            {
                                hasAll = false;
                            }
                        }
                        if (!(Input.GetKey(KeyCode.LeftShift) || hasAll))
                        {
                            foreach (var knowledgeSkillBtn in Buttons[megaKnowledge.set].Values)
                            {
                                knowledgeSkillBtn.SetState(KnowlegdeSkillBtnState.Available);
                            }

                            foreach (var mkv in Main.MegaKnowledges.Values.Where(mkv =>
                                                                                 mkv.set == megaKnowledge.set))
                            {
                                mkv.enabled = false;
                            }
                        }

                        if (Input.GetKey(KeyCode.LeftAlt))
                        {
                            megaKnowledge.enabled = false;
                            skillBtn.SetState(KnowlegdeSkillBtnState.Available);
                        }
                        else
                        {
                            megaKnowledge.enabled = true;

                            skillBtn.SetState(KnowlegdeSkillBtnState.Purchased);
                            knowledgeSkillTree.BtnClicked(skillBtn);
                            knowledgeSkillTree.selectedPanelTitleTxt.SetText(megaKnowledge.name);
                            knowledgeSkillTree.selectedPanelDescTxt.SetText(megaKnowledge.description);
                        }
                    });
                    btn.Construct(newButton);
                    if (!Buttons.ContainsKey(megaKnowledge.set))
                    {
                        Buttons[megaKnowledge.set] = new Dictionary <string, KnowledgeSkillBtn>();
                    }

                    Buttons[megaKnowledge.set][megaKnowledgeKey] = btn;
                    btn.SetState(megaKnowledge.enabled
                        ? KnowlegdeSkillBtnState.Purchased
                        : KnowlegdeSkillBtnState.Available);

                    var image = btn.GetComponentsInChildren <Component>().First(component => component.name == "Icon")
                                .GetComponent <Image>();

                    ResourceLoader.LoadSpriteFromSpriteReferenceAsync(new SpriteReference(megaKnowledge.GUID), image,
                                                                      false);
                    image.mainTexture.filterMode = FilterMode.Trilinear;
                }

                foreach (var gameObject in knowledgeSkillTree.scrollers)
                {
                    gameObject.GetComponent <RectTransform>().sizeDelta += new Vector2(0, 500);
                }
            }
Пример #43
0
        private async Task InitialViewModel()
        {
            CurrentTime = DateTime.Now;
            UpdateTime  = fetchresult.Location.UpdateTime;
            utcOffset   = UpdateTime - fetchresult.Location.UtcTime;
            RefreshCurrentTime();
            CurrentTimeRefreshTask();
            todayIndex = Array.FindIndex(fetchresult.DailyForecast, x =>
            {
                return(x.Date.Date == CurrentTime.Date);
            });
            nowHourIndex = Array.FindIndex(fetchresult.HourlyForecast, x =>
            {
                return((x.DateTime - CurrentTime).TotalSeconds > 0);
            });
            if (CurrentTime.Hour <= sunRise.Hours)
            {
                todayIndex--;
            }
            if (todayIndex < 0)
            {
                todayIndex = 0;
            }
            if (nowHourIndex < 0)
            {
                nowHourIndex = 0;
            }
            if (fetchresult.DailyForecast[todayIndex].SunRise == default(TimeSpan) || fetchresult.DailyForecast[todayIndex].SunSet == default(TimeSpan))
            {
                sunRise = Core.LunarCalendar.SunRiseSet.GetRise(new Models.Location(currentCityModel.Latitude, currentCityModel.Longitude), CurrentTime);
                sunSet  = Core.LunarCalendar.SunRiseSet.GetSet(new Models.Location(currentCityModel.Latitude, currentCityModel.Longitude), CurrentTime);
            }
            else
            {
                sunRise = fetchresult.DailyForecast[todayIndex].SunRise;
                sunSet  = fetchresult.DailyForecast[todayIndex].SunSet;
            }
            City        = currentCityModel.City;
            isNight     = WeatherModel.CalculateIsNight(CurrentTime, sunRise, sunSet);
            this.Glance = Models.Glance.GenerateGlanceDescription(fetchresult, isNight, TemperatureDecoratorConverter.Parameter, DateTime.Now);
            CityGlance  = (City + "  " + Glance);
            Date        = CurrentTime.ToString(settings.Preferences.GetDateFormat());

            var calendar = new CalendarInfo(CurrentTime);
            var loader   = new ResourceLoader();


            LunarCalendar = settings.Preferences.UseLunarCalendarPrimary ? (("农历 " + calendar.LunarYearSexagenary + "年" + calendar.LunarMonthText + "月" + calendar.LunarDayText + "    " + calendar.SolarTermStr).Trim()) : string.Empty;
            Hum           = ": " + fetchresult.HourlyForecast[nowHourIndex].Humidity + "%";
            Pop           = ": " + fetchresult.HourlyForecast[nowHourIndex].Pop + "%";
            Pcpn          = ": " + fetchresult.NowWeather.Precipitation + " mm";
            var v = new VisibilityConverter();

            Vis = ": " + (fetchresult.NowWeather.Visibility == null ? "N/A" : v.Convert(fetchresult.NowWeather.Visibility, null, null, null));
            var w = new WindSpeedConverter();

            Scale = ": " + (fetchresult.NowWeather.Wind == null ? "N/A" : w.Convert(fetchresult.NowWeather.Wind, null, null, null));
            var d = new WindDirectionConverter();

            Dir = ": " + (fetchresult.NowWeather.Wind == null ? "N/A" : d.Convert(fetchresult.NowWeather.Wind, null, null, null));
            var p = new PressureConverter();

            Pressure = ": " + (fetchresult.NowWeather.Pressure == null ? "N/A" : p.Convert(fetchresult.NowWeather.Pressure, null, null, null));

            var t = new TimeSpanConverter();

            SunRise       = ": " + (string)t.Convert(sunRise, null, null, null);
            SunSet        = ": " + (string)t.Convert(sunSet, null, null, null);
            this.Location = ": " + new Models.Location(currentCityModel.Latitude, currentCityModel.Longitude).ToString();
            var off = utcOffset.Hours;

            Offset = ": UTC" + (off >= 0 ? " +" : " -") + t.Convert(utcOffset, null, null, null);

            var uri = await settings.Immersive.GetCurrentBackgroundAsync(fetchresult.NowWeather.Now.Condition, isNight);

            if (uri != null)
            {
                try
                {
                    CurrentBG = new BitmapImage(uri);
                }
                catch (Exception)
                {
                }
            }
            List <KeyValuePair <int, double> > doubles0 = new List <KeyValuePair <int, double> >();
            List <KeyValuePair <int, double> > doubles1 = new List <KeyValuePair <int, double> >();
            List <KeyValuePair <int, double> > doubles2 = new List <KeyValuePair <int, double> >();
            List <KeyValuePair <int, double> > doubles3 = new List <KeyValuePair <int, double> >();
            List <KeyValuePair <int, double> > doubles5 = new List <KeyValuePair <int, double> >();
            List <KeyValuePair <int, double> > doubles4 = new List <KeyValuePair <int, double> >();

            if (!fetchresult.HourlyForecast.IsNullorEmpty())
            {
                for (int i = nowHourIndex + 1; i < fetchresult.HourlyForecast.Length; i++)
                {
                    if (fetchresult.HourlyForecast[i].Temprature != null)
                    {
                        doubles0.Add(new KeyValuePair <int, double>(i, fetchresult.HourlyForecast[i].Temprature.ActualDouble(TemperatureDecoratorConverter.Parameter)));
                    }
                    if (fetchresult.HourlyForecast[i].Pop != default(uint))
                    {
                        doubles1.Add(new KeyValuePair <int, double>(i, fetchresult.HourlyForecast[i].Pop));
                    }
                    if (fetchresult.HourlyForecast[i].Wind != null)
                    {
                        doubles4.Add(new KeyValuePair <int, double>(i, fetchresult.HourlyForecast[i].Wind.Speed.ActualDouble(WindSpeedConverter.SpeedParameter)));
                    }
                }
                var sb = new StringBuilder();
                if (doubles0 != null && doubles0.Count > 1)
                {
                    GetHourlyXText(doubles0, sb);
                    Forecasts.Add(new GraphViewModel(doubles0, null, new SolidColorBrush(Palette.GetRandom()), new SolidColorBrush(Palette.Cyan), string.Format(loader.GetString("HourlyDetailsTemperature"), doubles0.Count), Temperature.GetFormat(TemperatureDecoratorConverter.Parameter), -280, 9999, sb.ToString()));
                }
                if (doubles1 != null && doubles1.Count > 1)
                {
                    GetHourlyXText(doubles1, sb);
                    Forecasts.Add(new GraphViewModel(doubles1, null, new SolidColorBrush(Palette.GetRandom()), new SolidColorBrush(Colors.Transparent), string.Format(loader.GetString("HourlyDetailsPop"), doubles1.Count), "%", 0, 100, sb.ToString()));
                }
                if (doubles4 != null && doubles4.Count > 1)
                {
                    GetHourlyXText(doubles4, sb);
                    Forecasts.Add(new GraphViewModel(doubles4, null, new SolidColorBrush(Palette.GetRandom()), new SolidColorBrush(Colors.Transparent), string.Format(loader.GetString("HourlyDetailsWind"), doubles4.Count), Wind.GetSpeedFormat(WindSpeedConverter.SpeedParameter), 0, 1000, sb.ToString()));
                }
            }

            doubles0.Clear();
            doubles1.Clear();
            doubles2.Clear();
            doubles3.Clear();
            doubles4.Clear();
            doubles5.Clear();

            if (!fetchresult.DailyForecast.IsNullorEmpty())
            {
                for (int i = todayIndex + 1; i < fetchresult.DailyForecast.Length; i++)
                {
                    if (fetchresult.DailyForecast[i].HighTemp != null && fetchresult.DailyForecast[i].LowTemp != null)
                    {
                        doubles0.Add(new KeyValuePair <int, double>(i, fetchresult.DailyForecast[i].HighTemp.ActualDouble(TemperatureDecoratorConverter.Parameter)));
                        doubles1.Add(new KeyValuePair <int, double>(i, fetchresult.DailyForecast[i].LowTemp.ActualDouble(TemperatureDecoratorConverter.Parameter)));
                    }
                    if (fetchresult.DailyForecast[i].Pop != default(uint))
                    {
                        doubles2.Add(new KeyValuePair <int, double>(i, fetchresult.DailyForecast[i].Pop));
                    }
                    if (fetchresult.DailyForecast[i].Precipitation != default(float))
                    {
                        doubles3.Add(new KeyValuePair <int, double>(i, fetchresult.DailyForecast[i].Precipitation));
                    }
                    if (fetchresult.DailyForecast[i].Visibility != null)
                    {
                        doubles5.Add(new KeyValuePair <int, double>(i, fetchresult.DailyForecast[i].Visibility.ActualDouble(VisibilityConverter.LengthParameter)));
                    }
                    if (fetchresult.DailyForecast[i].Wind != null)
                    {
                        doubles4.Add(new KeyValuePair <int, double>(i, fetchresult.DailyForecast[i].Wind.Speed.ActualDouble(WindSpeedConverter.SpeedParameter)));
                    }
                }
                var sb = new StringBuilder();
                if (!doubles0.IsNullorEmpty() && !doubles1.IsNullorEmpty())
                {
                    GetDailyXText(doubles0, sb);
                    Forecasts.Add(new GraphViewModel(doubles0, doubles1, new SolidColorBrush(Palette.Orange), new SolidColorBrush(Palette.Cyan), string.Format(loader.GetString("DailyDetailsTemp"), doubles0.Count), Temperature.GetFormat(TemperatureDecoratorConverter.Parameter), -280, 9999, sb.ToString()));
                }
                if (doubles2 != null && doubles2.Count > 1)
                {
                    GetDailyXText(doubles2, sb);
                    Forecasts.Add(new GraphViewModel(doubles2, null, new SolidColorBrush(Palette.GetRandom()), new SolidColorBrush(Colors.Transparent), string.Format(loader.GetString("DailyDetailsPop"), doubles2.Count), "%", 0, 100, sb.ToString()));
                }
                if (doubles3 != null && doubles3.Count > 1)
                {
                    GetDailyXText(doubles3, sb);
                    Forecasts.Add(new GraphViewModel(doubles3, null, new SolidColorBrush(Palette.GetRandom()), new SolidColorBrush(Colors.Transparent), string.Format(loader.GetString("DailyDetailsPrep"), doubles3.Count), "mm", 0, 100, sb.ToString()));
                }
                if (doubles5 != null && doubles5.Count > 1)
                {
                    GetDailyXText(doubles5, sb);
                    Forecasts.Add(new GraphViewModel(doubles5, null, new SolidColorBrush(Palette.GetRandom()), new SolidColorBrush(Colors.Transparent), string.Format(loader.GetString("DailyDetailsVis"), doubles5.Count), Length.GetFormat(VisibilityConverter.LengthParameter), 0, 1000, sb.ToString()));
                }
                if (doubles4 != null && doubles4.Count > 1)
                {
                    GetDailyXText(doubles4, sb);
                    Forecasts.Add(new GraphViewModel(doubles4, null, new SolidColorBrush(Palette.GetRandom()), new SolidColorBrush(Colors.Transparent), string.Format(loader.GetString("DailyDetailsWind"), doubles4.Count), Wind.GetSpeedFormat(WindSpeedConverter.SpeedParameter), 0, 1000, sb.ToString()));
                }
            }

            OnFetchDataComplete();
        }
 /// <summary>
 /// Returns as <seealso cref="CharArraySet"/> from wordFiles, which
 /// can be a comma-separated list of filenames
 /// </summary>
 protected internal CharArraySet GetWordSet(ResourceLoader loader, string wordFiles, bool ignoreCase)
 {
     assureMatchVersion();
     IList<string> files = splitFileNames(wordFiles);
     CharArraySet words = null;
     if (files.Count > 0)
     {
         // default stopwords list has 35 or so words, but maybe don't make it that
         // big to start
         words = new CharArraySet(luceneMatchVersion, files.Count * 10, ignoreCase);
         foreach (string file in files)
         {
             var wlist = getLines(loader, file.Trim());
             words.AddAll(StopFilter.makeStopSet(luceneMatchVersion, wlist, ignoreCase));
         }
     }
     return words;
 }
Пример #45
0
 private void saveToolStripMenuItem_Click(object sender, EventArgs e)
 {
     resourceGrid1.ApplyCurrentCellEdit();
     ResourceLoader.SaveAll();
 }
 /// <summary>
 /// same as <seealso cref="#getWordSet(ResourceLoader, String, boolean)"/>,
 /// except the input is in snowball format. 
 /// </summary>
 protected internal CharArraySet getSnowballWordSet(ResourceLoader loader, string wordFiles, bool ignoreCase)
 {
     assureMatchVersion();
     IList<string> files = splitFileNames(wordFiles);
     CharArraySet words = null;
     if (files.Count > 0)
     {
         // default stopwords list has 35 or so words, but maybe don't make it that
         // big to start
         words = new CharArraySet(luceneMatchVersion, files.Count * 10, ignoreCase);
         foreach (string file in files)
         {
             InputStream stream = null;
             TextReader reader = null;
             try
             {
                 stream = loader.openResource(file.Trim());
                 CharsetDecoder decoder = StandardCharsets.UTF_8.newDecoder().onMalformedInput(CodingErrorAction.REPORT).onUnmappableCharacter(CodingErrorAction.REPORT);
                 reader = new InputStreamReader(stream, decoder);
                 WordlistLoader.getSnowballWordSet(reader, words);
             }
             finally
             {
                 IOUtils.closeWhileHandlingException(reader, stream);
             }
         }
     }
     return words;
 }
Пример #47
0
    // Use this for initialization
    void Start()
    {
        _loader = GetComponent<ResourceLoader>();

        if (!string.IsNullOrEmpty(levelFile)) {
            LoadLevelFile(levelFile);
        } else {
            Debug.Log("No level to load");
        }

        if (_tiles == null) {
            Debug.Log("No Level is loaded");
        }
    }
	  /*
	   * Read custom rules from a file, and create a RuleBasedCollator
	   * The file cannot support comments, as # might be in the rules!
	   */
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private java.text.Collator createFromRules(String fileName, ResourceLoader loader) throws java.io.IOException
	  private Collator createFromRules(string fileName, ResourceLoader loader)
	  {
		InputStream input = null;
		try
		{
		 input = loader.openResource(fileName);
		 string rules = toUTF8String(input);
		 return new RuleBasedCollator(rules);
		}
		catch (ParseException e)
		{
		  // invalid rules
		  throw new IOException("ParseException thrown while parsing rules", e);
		}
		finally
		{
		  IOUtils.closeWhileHandlingException(input);
		}
	  }
	  public virtual void Inform(ResourceLoader loader)
	  {
		if (wordFiles != null)
		{
		  protectedWords = GetWordSet(loader, wordFiles, false);
		}
		if (types != null)
		{
		  IList<string> files = splitFileNames(types);
		  IList<string> wlist = new List<string>();
		  foreach (string file in files)
		  {
			IList<string> lines = getLines(loader, file.Trim());
			wlist.AddRange(lines);
		  }
		  typeTable = parseTypes(wlist);
		}
	  }
Пример #50
0
        private void LoadConsumers()
        {
            String oauthConfigString = ResourceLoader.GetContent(new FileInfo(AppDomain.CurrentDomain.BaseDirectory + OAUTH_CONFIG));

            InitFromConfigString(oauthConfigString);
        }
 /// <summary>
 /// Returns the resource's lines (with content treated as UTF-8)
 /// </summary>
 protected internal IList<string> getLines(ResourceLoader loader, string resource)
 {
     return WordlistLoader.getLines(loader.openResource(resource), StandardCharsets.UTF_8);
 }
Пример #52
0
 public override void _Ready()
 {
     _bulletScene = ResourceLoader.Load("res://src/Objects/Bullets/Bullet.tscn") as PackedScene;
 }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void inform(ResourceLoader loader) throws java.io.IOException
	  public virtual void inform(ResourceLoader loader)
	  {
		if (language != null)
		{
		  // create from a system collator, based on Locale.
		  collator = createFromLocale(language, country, variant);
		}
		else
		{
		  // create from a custom ruleset
		  collator = createFromRules(custom, loader);
		}

		// set the strength flag, otherwise it will be the default.
		if (strength != null)
		{
		  if (strength.Equals("primary", StringComparison.CurrentCultureIgnoreCase))
		  {
			collator.Strength = Collator.PRIMARY;
		  }
		  else if (strength.Equals("secondary", StringComparison.CurrentCultureIgnoreCase))
		  {
			collator.Strength = Collator.SECONDARY;
		  }
		  else if (strength.Equals("tertiary", StringComparison.CurrentCultureIgnoreCase))
		  {
			collator.Strength = Collator.TERTIARY;
		  }
		  else if (strength.Equals("identical", StringComparison.CurrentCultureIgnoreCase))
		  {
			collator.Strength = Collator.IDENTICAL;
		  }
		  else
		  {
			throw new System.ArgumentException("Invalid strength: " + strength);
		  }
		}

		// set the decomposition flag, otherwise it will be the default.
		if (decomposition != null)
		{
		  if (decomposition.Equals("no", StringComparison.CurrentCultureIgnoreCase))
		  {
			collator.Decomposition = Collator.NO_DECOMPOSITION;
		  }
		  else if (decomposition.Equals("canonical", StringComparison.CurrentCultureIgnoreCase))
		  {
			collator.Decomposition = Collator.CANONICAL_DECOMPOSITION;
		  }
		  else if (decomposition.Equals("full", StringComparison.CurrentCultureIgnoreCase))
		  {
			collator.Decomposition = Collator.FULL_DECOMPOSITION;
		  }
		  else
		  {
			throw new System.ArgumentException("Invalid decomposition: " + decomposition);
		  }
		}
	  }
Пример #54
0
 /// <summary>
 /// Loads ports descriptions from resource.
 /// </summary>
 /// <param name="resourceType">resource type, i.e. type of resource class specified in .resx file</param>
 /// <param name="resourceNames">resource names</param>
 public InPortDescriptionsAttribute(Type resourceType, params string[] resourceNames)
 {
     portDescriptions = ResourceLoader.Load(resourceType, resourceNames);
 }
Пример #55
0
 /// <summary>
 /// Loads ports types from resource.
 /// </summary>
 /// <param name="resourceType">resource type, i.e. type of resource class specified in .resx file</param>
 /// <param name="resourceNames">resource names</param>
 public OutPortTypesAttribute(Type resourceType, params string[] resourceNames)
 {
     portTypes = ResourceLoader.Load(resourceType, resourceNames);
 }
Пример #56
0
 private void AddLinksAndDescription(AccountsSettingsPaneCommandsRequestedEventArgs e)
 {
     e.HeaderText = ResourceLoader.GetForCurrentView().GetString("SignInDescriptionText");
 }
 /// <returns> a list of all rules </returns>
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
 //ORIGINAL LINE: protected Iterable<String> loadRules(String synonyms, ResourceLoader loader) throws java.io.IOException
 protected internal IEnumerable<string> loadRules(string synonyms, ResourceLoader loader)
 {
     IList<string> wlist = null;
     File synonymFile = new File(synonyms);
     if (synonymFile.exists())
     {
       wlist = getLines(loader, synonyms);
     }
     else
     {
       IList<string> files = splitFileNames(synonyms);
       wlist = new List<>();
       foreach (string file in files)
       {
     IList<string> lines = getLines(loader, file.Trim());
     wlist.AddRange(lines);
       }
     }
     return wlist;
 }
Пример #58
0
 // Called when the node enters the scene tree for the first time.
 public override void _Ready()
 {
     base._Ready();                                          // Execute the Ready function from the Entity class.
     _Sprite  = GetNode("AnimatedSprite") as AnimatedSprite; // Get sprite node
     DroppedS = ResourceLoader.Load("res://Content/Scenes/Entities/Spells/Dropped/Drop.tscn") as PackedScene;
 }
Пример #59
0
 public WindowsDocumentViewModelStrings(ResourceLoader resourceLoader)
 {
     RichTextDescription = resourceLoader.GetString("RichTextDescription");
     TextDescription     = resourceLoader.GetString("TextDescription");
     Untitled            = resourceLoader.GetString("Untitled");
 }
Пример #60
0
 static ResourcesExtension()
 {
     _resourceLoader = ResourceLoader.GetForViewIndependentUse("Resources");
 }