Exemplo n.º 1
0
        /// <summary>
        /// get the stock RSI data
        /// </summary>
        /// <param name="symbol"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public JObject GetRSIData(string symbol, string type)
        {
            string req  = GeneralTools.NetworkRequestStringBuilder(symbol, Constant.IntervalMapper[type], Constant.QUERY_FUNCTION_VALUE_RSI, "14", "close", _apiKey[0]);
            var    data = OriginalStockData(req);

            return(data);
        }
Exemplo n.º 2
0
        protected async override void OnClick()
        {
            //int test = await AddPortalItem();
            string stationTriplet = "Example: 13202000:ID:USGS";

            System.Windows.Forms.DialogResult res = GeneralTools.ShowInputDialog("Enter station triplet", ref stationTriplet, 400, 80);
            if (res == System.Windows.Forms.DialogResult.OK)
            {
                string[] pieces = stationTriplet.Split(':');
                if (pieces.Length != 3)
                {
                    MessageBox.Show("Please enter a valid station triplet!");
                    return;
                }
                Webservices ws      = new Webservices();
                var         success = await ws.UpdateAoiItemsAsync(stationTriplet.Trim());

                if (success == BA_ReturnCode.Success)
                {
                    MessageBox.Show("PDF items successfully updated for " + stationTriplet, "BAGIS-PRO");
                }
                else
                {
                    MessageBox.Show("PDF item update failed for " + stationTriplet + "!!", "BAGIS-PRO");
                }
            }
        }
Exemplo n.º 3
0
    void UpdateSoundsSetsCount()
    {
        string[] texturesNames = GeneralTools.GetArrayOf(terrain.terrainData.splatPrototypes, delegate(SplatPrototype splat) { return(splat.texture.name); });

        List <TerrainControllerSoundsSet> newSet = new List <TerrainControllerSoundsSet>();

        TerrainControllerSoundsSet tempObj;

        for (int x = 0; x < texturesNames.Length; x++)
        {
            tempObj = new TerrainControllerSoundsSet(texturesNames[x]);

            for (int y = 0; y < soundsSets.Count; y++)
            {
                if (soundsSets[y].TextureName == texturesNames[x])
                {
                    tempObj.SoundsSet = soundsSets[y].SoundsSet;
                    break;
                }
            }

            newSet.Add(tempObj);
        }

        soundsSets = newSet;
    }
Exemplo n.º 4
0
        protected async override void OnClick()
        {
            try
            {
                OpenItemDialog selectAoiDialog = new OpenItemDialog()
                {
                    Title       = "Select AOI Folder",
                    MultiSelect = false,
                    Filter      = ItemFilters.folders
                };
                if (selectAoiDialog.ShowDialog() == true)
                {
                    Module1.DeactivateState("Aoi_Selected_State");
                    IEnumerable <Item> selectedItems = selectAoiDialog.Items;
                    var            e    = selectedItems.FirstOrDefault();
                    BA_Objects.Aoi oAoi = await GeneralTools.SetAoiAsync(e.Path);

                    if (oAoi != null)
                    {
                        Module1.Current.CboCurrentAoi.SetAoiName(oAoi.Name);
                        MessageBox.Show("AOI is set to " + oAoi.Name + "!", "BAGIS PRO");
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("An error occurred while trying to set the AOI!! " + e.Message, "BAGIS PRO");
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Based on the symbol and type, get the stockMeta object which include the metadata (symbol....) and the datapoint
        /// </summary>
        /// <param name="symbol"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public StockMeta FetchStockMajorDataObject(string symbol, string type)
        {
            StockMeta result = new StockMeta();
            JObject   stockData, stockDataSMA_1 = new JObject(), stockDataSMA_2 = new JObject(), stockDataSMA_3 = new JObject();
            string    req = GeneralTools.NetworkRequestStringBuilder(symbol, Constant.IntervalMapper[type], Constant.typeMapper[type], string.Empty, string.Empty, _apiKey[0]);

            stockData = OriginalStockData(req);
            if (_memuSetting.ChartSettings["SMA10"])
            {
                string req_s1 = GeneralTools.NetworkRequestStringBuilder(symbol, Constant.IntervalMapper[type], Constant.QUERY_FUNCTION_VALUE_SMA, "10", "close", _apiKey[0]);
                stockDataSMA_1 = OriginalStockData(req_s1);
            }
            if (_memuSetting.ChartSettings["SMA50"])
            {
                string req_s2 = GeneralTools.NetworkRequestStringBuilder(symbol, Constant.IntervalMapper[type], Constant.QUERY_FUNCTION_VALUE_SMA, "50", "close", _apiKey[0]);
                stockDataSMA_2 = OriginalStockData(req_s2);
            }
            if (_memuSetting.ChartSettings["SMA200"])
            {
                string req_s3 = GeneralTools.NetworkRequestStringBuilder(symbol, Constant.IntervalMapper[type], Constant.QUERY_FUNCTION_VALUE_SMA, "200", "close", _apiKey[0]);
                stockDataSMA_3 = OriginalStockData(req_s3);
            }
            //result = BuildStockObject(stockData[Constant.METADATA]);
            AddStockMajorDataToStockObject(ref result, stockData, stockDataSMA_1, stockDataSMA_2, stockDataSMA_3, type);
            return(result);
        }
Exemplo n.º 6
0
        public JObject GetAROONData(string symbol)
        {
            string req  = GeneralTools.NetworkRequestStringBuilder(symbol, Constant.DAILY, Constant.QUERY_FUNCTION_VALUE_AROON, "14", "close", _apiKey[0]);
            var    data = OriginalStockData(req);

            return(data);
        }
Exemplo n.º 7
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (GeneralTools.ConfirmationBox("this action will close the application, confirm?"))
     {
         Application.Exit();
     }
 }
Exemplo n.º 8
0
        protected async override void OnClick()
        {
            try
            {
                Module1.DeactivateState("BtnExcelTables_State");
                var cmdShowHistory = FrameworkApplication.GetPlugInWrapper("esri_geoprocessing_showToolHistory") as ICommand;
                if (cmdShowHistory != null)
                {
                    if (cmdShowHistory.CanExecute(null))
                    {
                        cmdShowHistory.Execute(null);
                    }
                }
                BA_ReturnCode success = await GeneralTools.GenerateTablesAsync(true);

                Module1.ActivateState("BtnExcelTables_State");
                if (!success.Equals(BA_ReturnCode.Success))
                {
                    MessageBox.Show("An error occurred while generating the Excel tables!!", "BAGIS-PRO");
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("An exception occurred while trying to export the tables!! " + e.Message, "BAGIS PRO");
                Module1.Current.ModuleLogManager.LogError(nameof(OnClick),
                                                          "An error occurred while trying to export the tables!! " + e.Message);
            }
        }
Exemplo n.º 9
0
 private void Start()
 {
     director               = overallDirector.Instance;
     onTreeAnim             = GetComponent <Animation>();
     tapManager             = GameObject.Find("LeanCtrl").GetComponent <LeanFingerTap>();
     tools                  = GeneralTools.Instance;
     pickActivityRegistered = false;
 }
Exemplo n.º 10
0
        /*
         * private StockMeta BuildStockObject(JToken meta)
         * {
         *  StockMeta result = new StockMeta();
         *  result.Infomation = meta[Constant.INFORMATION].ToString();
         *  result.Date = meta[Constant.DATE].ToString();
         *  result.Symbol = meta[Constant.SYMBOL].ToString();
         *  return result;
         * }
         */
        /// <summary>
        /// Based on the original json data, we build the stockMeta object data points. This will be the datasource for the later on drawing
        /// </summary>
        /// <param name="result"></param>
        /// <param name="data"></param>
        /// <param name="SMA_10"></param>
        /// <param name="SMA_50"></param>
        /// <param name="SMA_200"></param>
        /// <param name="Type"></param>

        private void AddStockMajorDataToStockObject(ref StockMeta result, JObject data, JObject SMA_10, JObject SMA_50, JObject SMA_200, string Type)
        {
            var meta = data[Constant.METADATA];
            List <StockPoint> points = new List <StockPoint>();
            var dataPoints           = data[Type];
            IEnumerable <JProperty> dataPoints_SMA_10  = new JObject().OfType <JProperty>();
            IEnumerable <JProperty> dataPoints_SMA_50  = new JObject().OfType <JProperty>();
            IEnumerable <JProperty> dataPoints_SMA_200 = new JObject().OfType <JProperty>();

            if (_memuSetting.ChartSettings["SMA10"])
            {
                dataPoints_SMA_10 = SMA_10[Constant.SMAKEY].OfType <JProperty>();
            }
            if (_memuSetting.ChartSettings["SMA50"])
            {
                dataPoints_SMA_50 = SMA_50[Constant.SMAKEY].OfType <JProperty>();
            }
            if (_memuSetting.ChartSettings["SMA200"])
            {
                dataPoints_SMA_200 = SMA_200[Constant.SMAKEY].OfType <JProperty>();
            }
            int i = 0;  ///for current stage, just hard coded 100 points

            foreach (JProperty point in dataPoints.OfType <JProperty>())
            {
                StockPoint tmp = new StockPoint();
                tmp.Date       = point.Name.ToString();
                tmp.OpenPrice  = GeneralTools.StringParser(point.Value[Constant.OPENPRICE].ToString());
                tmp.ClosePrice = GeneralTools.StringParser(point.Value[Constant.CLOSEPRICE].ToString());
                tmp.HighPrice  = GeneralTools.StringParser(point.Value[Constant.HIGHPRICE].ToString());
                tmp.LowPrice   = GeneralTools.StringParser(point.Value[Constant.LOWPRICE].ToString());
                tmp.Volume     = Int32.Parse(point.Value[Constant.VOLUME].ToString());
                if (_memuSetting.ChartSettings["SMA10"])
                {
                    tmp.SMA_10 = ParseValue("", dataPoints_SMA_10, Constant.SMA, i, 1);
                }
                if (_memuSetting.ChartSettings["SMA50"])
                {
                    tmp.SMA_50 = ParseValue("", dataPoints_SMA_50, Constant.SMA, i, 1);
                }
                if (_memuSetting.ChartSettings["SMA200"])
                {
                    tmp.SMA_200 = ParseValue("", dataPoints_SMA_200, Constant.SMA, i, 1);
                }
                points.Add(tmp);
                i++;
                if (i >= 100)
                {
                    break;
                }
            }
            result.Infomation = meta[Constant.INFORMATION].ToString();
            result.Date       = meta[Constant.DATE].ToString();
            result.Symbol     = meta[Constant.SYMBOL].ToString();
            result.Charts[Constant.ChartMapper[Type]] = points;
        }
Exemplo n.º 11
0
    // Start is called before the first frame update
    void Start()
    {
        GeneralTools    Tools = GeneralTools.Instance;
        overallDirector dir   = overallDirector.Instance;

        Tools.MoveObjTo(scissors, dir.scissorsPosition);
        Tools.MoveObjTo(thread, dir.threadPosition);
        Tools.MoveObjTo(needle, dir.needlePosition);
        Tools.MoveObjTo(globe, dir.globePosition);
    }
Exemplo n.º 12
0
        private void btn_Save_Click(object sender, EventArgs e)
        {
            var user = MapTxtBoxesToStudent();

            var repository = new UserRepository();

            repository.Insert(user);

            GeneralTools.WarningBox("User inserted");
            Close();
        }
Exemplo n.º 13
0
        private void btn_SaveStudent_Click(object sender, EventArgs e)
        {
            var student = MapTxtBoxesToStudent();

            var repository = new StudentRepository();

            repository.Insert(student);

            GeneralTools.WarningBox("Student inserted");
            Close();
        }
Exemplo n.º 14
0
        private void btn_Delete_Click(object sender, EventArgs e)
        {
            if (GeneralTools.ConfirmationBox("Are you sure you want to delete this student?") == true)
            {
                var studentRepository = new StudentRepository();

                var studentNumber = Convert.ToInt32(txtBox_studentNumber.Text);

                studentRepository.Delete(studentNumber);

                Close();
            }
        }
Exemplo n.º 15
0
        protected Stack <Character> CharacterStack; //	Stack storing all character instances.

        private void SortCharacterArray()
        {
            for (int x = 0; x < this.Characters.Length; x++)
            {
                for (int y = 0; y < (this.Characters.Length - x - 1); x++)
                {
                    if (this.Characters[x].Position.Y > this.Characters[x + 1].Position.Y)
                    {
                        GeneralTools.Swap <Character>(ref this.Characters[x], ref this.Characters[x + 1]);
                    }
                }
            }
        }
Exemplo n.º 16
0
        private void dataGridStudent_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Delete)
            {
                if (GeneralTools.ConfirmationBox("Are you sure you want to delete this student?") == true)
                {
                    var studentRepository = new StudentRepository();

                    studentRepository.Delete(Convert.ToInt64(dataGridStudent.CurrentRow.Cells[dataGridStudent.Columns["StudentNumber"].Index].FormattedValue.ToString()));

                    RefreshStudentGrid();
                }
            }
        }
Exemplo n.º 17
0
    private void InitializeInstance()
    {
        if (Instance != null & Instance == this)
        {
            return;
        }

        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(gameObject);
        }
    }
Exemplo n.º 18
0
        public void AddRSIDataToStockObject(ref StockMeta result, string symbol, string Type)
        {
            var data         = GetRSIData(symbol, Type);
            var dataPoints   = data[Constant.RSIKEY].OfType <JProperty>();
            var resultPoints = result.Charts[Constant.ChartMapper[Type]];
            int i            = 0;

            foreach (JProperty point in dataPoints)
            {
                resultPoints[i].RSI = GeneralTools.StringParser(point.Value[Constant.RSI].ToString());
                i++;
                if (i >= resultPoints.Count)
                {
                    break;
                }
            }
        }
Exemplo n.º 19
0
        internal void processFile(string filename)
        {
            string foo = "";

            byte[] bytes = File.ReadAllBytes(filename);
            string hex   = BitConverter.ToString(bytes);

            _hex = GeneralTools.ReplaceEx(hex, "-", " ");

            Task t = Task.Run(() =>
            {
                foo = Encoding.ASCII.GetString(bytes).Replace((char)0, '.');
            });

            t.Wait();
            _text = GeneralTools.ReplaceEx(foo, "?", ".");
        }
Exemplo n.º 20
0
        public void AddAROONDataToStockObject(ref StockSummary result, string symbol)
        {
            var           data        = GetAROONData(symbol);
            var           dataPoints  = data[Constant.AROONKEY].OfType <JProperty>();
            List <double> AROONValues = new List <double>();
            int           i           = 0;

            foreach (JProperty point in dataPoints)
            {
                AROONValues.Add(GeneralTools.StringParser(point.Value[Constant.AROON].ToString()));
                if (i >= 200)
                {
                    break;
                }
                i++;
            }
            result.CacheData.Add(Constant.AROONKEY, AROONValues);
        }
Exemplo n.º 21
0
        private double VolumeStringToVolume(string volume)
        {
            var length     = volume.Length;
            int multipiler = 1;

            if (volume[length - 1] == 'M')
            {
                multipiler = 1000000;
            }
            else if (volume[length - 1] == 'K')
            {
                multipiler = 1000;
            }
            else
            {
                return(GeneralTools.StringParser(volume));
            }
            return(GeneralTools.StringParser(volume.Substring(0, length - 1)) * multipiler);
        }
Exemplo n.º 22
0
        private void AddStockMajorDataToStockSummary(ref StockSummary result)
        {
            string            req        = GeneralTools.NetworkRequestStringBuilder(result.Symbol, Constant.DAILY, Constant.QUERY_FUNCTION_VALUE_DAILY, string.Empty, string.Empty, _apiKey[0]);
            var               stockData  = OriginalStockData(req);
            var               dataPoints = stockData[Constant.DAILYCHART];
            List <StockPoint> points     = new List <StockPoint>();

            foreach (JProperty point in dataPoints.OfType <JProperty>())
            {
                StockPoint tmp = new StockPoint();
                tmp.Date       = point.Name.ToString();
                tmp.OpenPrice  = GeneralTools.StringParser(point.Value[Constant.OPENPRICE].ToString());
                tmp.ClosePrice = GeneralTools.StringParser(point.Value[Constant.CLOSEPRICE].ToString());
                tmp.HighPrice  = GeneralTools.StringParser(point.Value[Constant.HIGHPRICE].ToString());
                tmp.LowPrice   = GeneralTools.StringParser(point.Value[Constant.LOWPRICE].ToString());
                tmp.Volume     = Int32.Parse(point.Value[Constant.VOLUME].ToString());
                points.Add(tmp);
            }
            result.CacheData.Add(Constant.DAILYCHART, points);
        }
Exemplo n.º 23
0
        public IActionResult Index(string title, int id)
        {
            List <News> news = new List <News> {
                new News {
                    id = 1, title = "Edirnede, barajlarda doluluk oranı yüzde 46ya ulaştı", imgPath = "/assets/img/1.jpg", desc = "Birinci Haberin Başlığı", date = DateTime.Now.AddDays(-10)
                },
                new News {
                    id = 2, title = "Haber Başlığı 2", imgPath = "/assets/img/2.jpg", desc = "İkinci Haberin Başlığı", date = DateTime.Now.AddDays(-22)
                },
                new News {
                    id = 3, title = "Haber Başlığı 3 ", imgPath = "/assets/img/3.jpg", desc = "Üçüncü Haberin Başlığı Something short and leading about the collection below—its contents, the creator, etc. Make it short and sweet, but not too short so folks don’t simply skip over it entirely.", date = DateTime.Now.AddDays(-14)
                },
                new News {
                    id = 4, title = "Haber Başlığı 4", imgPath = "/assets/img/4.jpg", desc = "Dördüncü Haberin Başlığı", date = DateTime.Now.AddDays(-10)
                },
                new News {
                    id = 5, title = "Haber Başlığı 5", imgPath = "/assets/img/5.jpg", desc = "Beşinci Haberin Başlığı", date = DateTime.Now.AddDays(-12)
                },
                new News {
                    id = 6, title = "Haber Başlığı 6", imgPath = "/assets/img/6.jpg", desc = "Altıncı Haberin Başlığı", date = DateTime.Now.AddDays(-4)
                }
            };

            if (!string.IsNullOrEmpty(title))
            {
                News selectedNews = news.FirstOrDefault(x => GeneralTools.KarakterDuzelt(x.title) == title && x.id == id) ?? null;
                if (selectedNews == null)
                {
                    return(Redirect("/"));
                }
                else
                {
                    return(View(selectedNews));
                }
            }
            else
            {
                return(Redirect("/"));
            }
        }
Exemplo n.º 24
0
    // Spawn a projectile and send the projectile
    private void Shoot()
    {
        if (currentTime > 1f)
        {
            currentTime = 0;
            int i = GeneralTools.GetFirstNullIndexFromArray(projectileIds);
            if (i != -1)
            {
                Vector2 direction = (((BasePlayer)targetObj).transform.position - transform.position).normalized;

                Projectile projectile = GameManager.ProjectileM.SpawnProjectile(
                    1,
                    (Vector2)transform.position + direction,
                    direction,
                    Projectile.Owner.Enemy,
                    id,
                    (byte)i);

                projectileIds[i] = projectile.gameObject;
                MultiplayerManager.peerManager.SendDataToAllPeers(projectile.GetByteData(), PacketType.projectile, PacketValue.addUpdate, true);
            }
        }
    }
Exemplo n.º 25
0
        /// <summary>
        /// currently 0 -> MACD; 1->RSI
        /// </summary>
        /// <param name="canvas"></param>
        /// <param name="y_count"></param>
        /// <param name="type"></param>
        public void DrawMACDToCanvas(ref Canvas canvas, int y_count)
        {
            double ymid  = canvas.Height / 2;
            double xmin  = marginX;
            double xmax  = canvas.Width - marginX;
            double stepX = (xmax - xmin) / (x_count - 1);
            double stepY = canvas.Height / (y_count - 1);

            BuilderTools.Axis(ref canvas, xmin, xmax, ymid, ymid, x_count, 0, datesAxisKeypoint, 1, Brushes.Black);
            BuilderTools.Axis(ref canvas, xmin, xmin, 0, 2 * ymid, y_count, 1, MACDAxisKeypoint, 1, Brushes.Black);

            var lowVal   = GeneralTools.StringParser(MACDAxisKeypoint.First());
            var highVal  = GeneralTools.StringParser(MACDAxisKeypoint.Last());
            var MACDPath = GetMACDChartPath(xmin, ymid, stepX, stepY, lowVal, highVal);

            foreach (var path in MACDPath)
            {
                canvas.Children.Add(path);
            }

            canvas.MouseDown += new MouseButtonEventHandler(AddPointInfo);
            canvas.MouseUp   += new MouseButtonEventHandler(RemovePointInfo);
        }
Exemplo n.º 26
0
        private void btn_Login_Click(object sender, EventArgs e)
        {
            var userRepository = new UserRepository();

            var response = userRepository.Login(txtBox_login.Text, txtbox_password.Text);

            if (response == LoginEnum.Successful)
            {
                LoggedInDetails.SetUserLogged(txtBox_login.Text);
                LoggedInDetails.SetLoggedInState(true);
                Close();
                return;
            }

            if (response == LoginEnum.IncorrectLogin)
            {
                GeneralTools.WarningBox("Incorrect login.");
            }

            if (response == LoginEnum.IncorrectPassword)
            {
                GeneralTools.WarningBox("Incorrect password.");
            }
        }
Exemplo n.º 27
0
 public GeneralTools()
 {
     s_instance = this;
 }
Exemplo n.º 28
0
 // Check if room for projectile
 public virtual int CanDoAttack()
 {
     return(GeneralTools.GetFirstNullIndexFromArray(projectileIds));
 }
Exemplo n.º 29
0
 private void txtBox_Enter(object sender, EventArgs e)
 {
     GeneralTools.txtBox_Enter(sender, e);
 }
Exemplo n.º 30
0
 private void txtBox_Leave(object sender, EventArgs e)
 {
     GeneralTools.txtBox_Leave(sender, e);
 }