コード例 #1
0
ファイル: MainActivity.cs プロジェクト: AndroidWG/SmartLyrics
        private async void ShowSearchResults(string query, int index)
        {
            #region UI Variables
            ListView    searchResults      = FindViewById <ListView>(Resource.Id.searchResults);
            ProgressBar searchLoadingWheel = FindViewById <ProgressBar>(Resource.Id.searchLoadingWheel);
            #endregion

            List <SongBundle> results = await Genius.GetSearchResults(query);

            if (index == t.Count)
            {
                SearchResultAdapter adapter = new SearchResultAdapter(this, results);
                searchResults.Adapter = adapter;
                resultsToView         = results;

                RunOnUiThread(() =>
                {
                    if (results.Count == 0)
                    {
                        Log(Type.Info, $"No results found for query {query}");
                        noResultsTxt.Visibility = ViewStates.Visible;
                        faceTxt.Visibility      = ViewStates.Visible;
                    }
                    else
                    {
                        Log(Type.Info, $"Added {results.Count} results of query '{query}' with index {index} to view at count {t.Count}");
                        noResultsTxt.Visibility = ViewStates.Gone;
                        faceTxt.Visibility      = ViewStates.Gone;
                    }

                    searchLoadingWheel.Visibility = ViewStates.Gone;
                });
            }
        }
コード例 #2
0
ファイル: GeniusTests.cs プロジェクト: kroad75/BANG
        public void TestGeniusTest()
        {
            //Assert.Fail();

            Genius g = new Genius("Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.48)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(sid=cp2)));User Id=cybosplus;Password=miji1212;"
                                  , null, null);

            g.TestGenius("A002230");
        }
コード例 #3
0
ファイル: MainActivity.cs プロジェクト: AndroidWG/SmartLyrics
        private async Task ShowSongDetails()
        {
            songInfo = await Genius.GetSongDetails(songInfo);

            UpdateSong(songInfo, true, true);
            Log(Type.Info, "Finished getting info from Genius");
            Analytics.TrackEvent("Finished getting info from Genius", new Dictionary <string, string> {
                { "SongID", songInfo.Normal.Id.ToString() }
            });
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: kroad75/BANG
        private void button1_Click(object sender, EventArgs e)
        {
            string        dbConnString   = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.48)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(sid=cp2)));User Id=cybosplus;Password=miji1212;";
            List <string> gStockCodeList = new List <string>();

            gStockCodeList.Add("A114090");

            Genius g = new Genius(dbConnString, gStockCodeList, LogWrite);

            g.Process();
        }
コード例 #5
0
        private void myTimer_OnTick(object state)
        {
            try
            {
                myTimer.Stop();

                if (DateTime.Now.Hour == 7 && DateTime.Now.Minute == 0 && DateTime.Now.Second == 0)
                {
                    SqlDal sd = new SqlDal(dbConnString);
                    gStockCodeList = sd.GetStockCode(StockGroup);
                }
                else if (DateTime.Now.Second == int.Parse(ExeSecond))
                {
                    DateTime sDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 9, 0, 0);
                    DateTime eDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 15, 15, 0);

                    DateTime EndMarketSDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 15, 45, 0);
                    DateTime EndMarketEDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 15, 55, 0);

                    DateTime DailyAllSellDate    = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 15, 10, 0);
                    DateTime ResetOrderStockDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 8, 0, 0);

                    DateTime Date0930 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 9, 30, 0);

                    //if (DateTime.Now.Hour == sDate.Hour && DateTime.Now.Minute == sDate.Minute)
                    //    Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss.fff") + " : " + "Simulator 시작");

                    //if (DateTime.Now.Hour == eDate.Hour && DateTime.Now.Minute == eDate.Minute)
                    //    Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss.fff") + " : " + "Simulator 종료");

                    if (DateTime.Now.DayOfWeek == DayOfWeek.Saturday ||
                        DateTime.Now.DayOfWeek == DayOfWeek.Sunday ||
                        isHoliday
                        )
                    {
                        //Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss.fff") + " : " + "주말에는 쉽니다");
                        myTimer.Start();
                        return;
                    }

                    // DATA BASED TRADING
                    if (DateTime.Now.Hour == int.Parse(INSERTTODAYTRADESUMMARY.Substring(0, 2)) &&
                        DateTime.Now.Minute == int.Parse(INSERTTODAYTRADESUMMARY.Substring(2, 2))
                        )
                    {
                        if (StockGroup == "GROUP1")
                        {
                            SqlDal sd = new SqlDal(dbConnString);
                            sd.InsertTodayTradeSummary();
                            flog.write(LogType.INFORMATION, "TradeSummary");

                            sd.ResetBalance();
                            flog.write(LogType.INFORMATION, "ResetBalance");

                            sd.SaveScoreMstHistory();
                            flog.write(LogType.INFORMATION, "SaveScoreMstHistory");
                        }
                    }
                    else if (DateTime.Now.Hour == ResetOrderStockDate.Hour && DateTime.Now.Minute == ResetOrderStockDate.Minute)
                    {
                        if (StockGroup == "GROUP1")
                        {
                            SqlDal sd = new SqlDal(dbConnString);
                            sd.ResetOrderStock();
                            flog.write(LogType.INFORMATION, "ResetOrderStock");
                        }
                    }
                    else if (DateTime.Now >= sDate &&
                             DateTime.Now < eDate
                             )
                    {
                        // StockCur 기반 매수여부 확인
                        //BANG.CYBOSPLUS.Trader.gini_STOCKCUR giniStockCur = new BANG.CYBOSPLUS.Trader.gini_STOCKCUR(dbConnString, gStockCodeList);
                        //giniStockCur.Process();

                        //BANG.CYBOSPLUS.Trader.gini_STOCKMST giniStockMst = new BANG.CYBOSPLUS.Trader.gini_STOCKMST(dbConnString, gStockCodeList);
                        //giniStockMst.Process();

                        if (DateTime.Now.Hour == DailyAllSellDate.Hour && DateTime.Now.Minute >= DailyAllSellDate.Minute)
                        {
                            SqlDal sd = new SqlDal(dbConnString);

                            if (sd.GetisDailyTrading())
                            {
                                sd.SellActionOverDay();
                                sd.SellAction1440();
                                flog.write(LogType.INFORMATION, "당일청산");
                            }
                            else
                            {
                                flog.write(LogType.INFORMATION, "당일청산 Flag=N");
                            }
                        }
                        else if (DateTime.Now < Date0930)
                        {
                            SqlDal sd = new SqlDal(dbConnString);

                            if (sd.GetisStopMinusSellIn0930())
                            {
                                sd.SellActionOverDay();
                                sd.SellActionIn0930();
                            }
                            else
                            {
                                Genius g = new Genius(dbConnString, gStockCodeList, LogWrite);
                                g.Process();

                                //System.Threading.Thread t = new System.Threading.Thread(g.Process);
                                //t.Start();
                            }
                        }
                        else
                        {
                            Genius g = new Genius(dbConnString, gStockCodeList, LogWrite);
                            g.Process();

                            //System.Threading.Thread t = new System.Threading.Thread(g.Process);
                            //t.Start();
                        }
                    }
                    else if (DateTime.Now >= EndMarketSDate &&
                             DateTime.Now < EndMarketEDate)
                    {
                        SqlDal sd = new SqlDal(dbConnString);
                        if (sd.GetisDailyTrading())
                        {
                            sd.SellActionOverDay();
                            sd.SellAction1440();
                            flog.write(LogType.INFORMATION, "장종료후 당일청산 시도");
                        }
                    }
                    else
                    {
                        //Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss.fff") + " : " + "09:00 ~ 15:00 까지만 영업합니다");
                        myTimer.Start();
                        return;
                    }
                }
            }
            catch (Exception e)
            {
                EventLog.WriteEntry("Simulator", e.ToString());
            }

            myTimer.Start();
        }
コード例 #6
0
ファイル: MainActivity.cs プロジェクト: AndroidWG/SmartLyrics
        private async Task ShowLyrics()
        {
            Log(Type.Info, "Started ShowLyrics method");

            #region UI Variables
            TextView           infoTxt            = FindViewById <TextView>(Resource.Id.infoTxt);
            ProgressBar        lyricsLoadingWheel = FindViewById <ProgressBar>(Resource.Id.lyricsLoadingWheel);
            SwipeRefreshLayout refreshLayout      = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout);
            ImageView          savedView          = FindViewById <ImageView>(Resource.Id.savedView);
            ImageButton        fabMore            = FindViewById <ImageButton>(Resource.Id.fabMore);
            #endregion

            string lyrics = await Genius.GetSongLyrics(songInfo);

            songInfo.Normal.Lyrics = lyrics;

            //TODO: Make auto-romanization happen after loading normal version of song
            //Auto-romanize based on preferences
            if (songInfo.Normal.Lyrics.ContainsJapanese() && Prefs.GetBoolean("auto_romanize", false))
            {
                RomanizedSong romanized = await JapaneseTools.RomanizeSong(songInfo.Normal, true);

                //Fill empty info for songs with romanized lyrics and non-romanized details
                if (string.IsNullOrEmpty(romanized.Title) &&
                    !string.IsNullOrEmpty(songInfo.Normal.Title))
                {
                    romanized.Title = songInfo.Normal.Title;
                }
                if (string.IsNullOrEmpty(romanized.Artist) &&
                    !string.IsNullOrEmpty(songInfo.Normal.Artist))
                {
                    romanized.Artist = songInfo.Normal.Artist;
                }
                if (string.IsNullOrEmpty(romanized.Album) &&
                    !string.IsNullOrEmpty(songInfo.Normal.Album))
                {
                    romanized.Album = songInfo.Normal.Album;
                }
                if (string.IsNullOrEmpty(romanized.FeaturedArtist) &&
                    !string.IsNullOrEmpty(songInfo.Normal.FeaturedArtist))
                {
                    romanized.FeaturedArtist = songInfo.Normal.FeaturedArtist;
                }

                songInfo.Romanized        = romanized;
                songInfo.Normal.Romanized = true;
            }
            else
            {
                if (songInfo.Romanized != null)
                {
                    songInfo.Romanized.Lyrics = "";
                }
            }

            UpdateSong(songInfo, false, false);
            RunOnUiThread(() =>
            {
                fabMore.Visibility   = ViewStates.Visible;
                savedView.Visibility = ViewStates.Gone;
                infoTxt.Visibility   = ViewStates.Visible;

                lyricsLoadingWheel.Visibility = ViewStates.Gone;
                refreshLayout.Refreshing      = false;
            });

            shouldCheck = true;

            Log(Type.Info, "Finished getting lyrics from Genius");
            Analytics.TrackEvent("Finished getting lyrics from Genius", new Dictionary <string, string> {
                { "SongID", songInfo.Normal.Id.ToString() }
            });
        }