Ejemplo n.º 1
0
 public DiagramPageViewModel(WorkflowInfo info)
 {
     WebInteraction.InitCultureInfo();
     InitializeProperty(info);
     InitCommand();
     InitializeDiagramModel();
 }
        public void SetUp()
        {
            _web = new WebInteractionSelenium(CurrentTestCase);

            _web.Navigate(TestDataSet.homePage);
            _web.SetBrowserSize(1920, 1200);
        }
Ejemplo n.º 3
0
        private void RefrushUser()
        {
            if (mUser == null)
            {
                return;
            }
            AVQuery <AVObject> query = new AVQuery <AVObject>("UserAvatars").WhereEqualTo("userObjectId", mUser.ObjectId);

            query.FindAsync().ContinueWith(t => {
                AVObject[] objs = t.Result.Cast <AVObject>().ToArray();
                if (objs.Length != 0)
                {
                    string avatarUrl = objs[0]["avatar"].ToString();
                    if (avatarUrl != "")
                    {
                        //var img = BitmapFrame.Create(new Uri(avatarUrl, UriKind.RelativeOrAbsolute));
                        //img.DownloadCompleted += (sender, e) =>
                        //{
                        //    avatar.Source = (BitmapImage)sender;
                        //};
                        avatar.Dispatcher.Invoke(() => avatar.Source = WebInteraction.GetImage(avatarUrl));
                    }
                }
            });

            userName.Text = mUser.Username;
        }
Ejemplo n.º 4
0
        public void Init()
        {
            _web = new WebInteraction(CurrentTestCase.TestCaseResult.LogPosts,
                                      new SeleniumTafDriver(CurrentTestCase.TestCaseResult.LogPosts, new ChromeDriver()));

            CurrentTestCase.AddReport(new TestCaseExecutionPlainTextReport());
            CurrentTestCase.AddReport(new TestCaseHtmlReport());
        }
Ejemplo n.º 5
0
        public void Init()
        {
            _web = new WebInteraction(CurrentTestCase.TestCaseResult.LogPostList,
                                      new SeleniumTafDriver(CurrentTestCase.TestCaseResult.LogPostList, new ChromeDriver()));

            CurrentTestCase.AddReport(new TestCaseExecutionPlainTextReport());
            CurrentTestCase.AddReport(new TestCaseHtmlReport());

            CurrentTestCase.Log(new LogPost.LogPostInfo("Browse to Skogsvårdsportalen"));
            _web.Navigate("https://skogsvardtestintern.sveaskog.se");
        }
Ejemplo n.º 6
0
        static public Dictionary <string, Ship> GetShips()
        {
            var result   = new Dictionary <string, Ship>();
            var shipInfo = WebInteraction.GET(SHIP_INFO_URL);

            shipInfo = shipInfo.Substring(13);
            shipInfo = shipInfo.Replace(@"'", @"""");

            var reader = new JsonTextReader(new StringReader(shipInfo));

            while (reader.Read())
            {
                if (reader.Path != string.Empty && Regex.Match(reader.Path, @"\d{10}").Value == reader.Path)
                {
                    if (!result.ContainsKey(reader.Path))
                    {
                        var ship = new Ship(reader.Path);
                        result.Add(ship.Cd, ship);
                    }
                    continue;
                }
                var match = Regex.Match(reader.Path, @"(\d{10})\.(.+)");
                switch (match.Groups[2].Value)
                {
                case "name":
                    result[match.Groups[1].Value].Name = reader.ReadAsString();
                    break;

                case "alias":
                    result[match.Groups[1].Value].Alias = reader.ReadAsString();
                    break;

                case "country":
                    result[match.Groups[1].Value].Country = reader.ReadAsString();
                    break;

                case "type":
                    result[match.Groups[1].Value].Type = reader.ReadAsString();
                    break;

                case "lvl":
                    result[match.Groups[1].Value].Lvl = reader.ReadAsInt32().Value;
                    break;
                }
            }
            return(result);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 子流程菜单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnMenu_Click(object sender, RoutedEventArgs e)
        {
            Node node = Part.FindAncestor <Node>(e.OriginalSource as UIElement);

            if (node == null)
            {
                return;
            }

            ActivityNode data = node.Data as ActivityNode;

            if (data == null)
            {
                return;
            }

            var element = sender as DependencyObject;
            DependencyObject topElement = null;

            while (true)
            {
                if (element == null)
                {
                    break;
                }
                topElement = element;
                element    = VisualTreeHelper.GetParent(element);
            }

            if (topElement == null)
            {
                return;
            }

            var main = topElement as MainPage;

            if (main == null)
            {
                return;
            }
            WebInteraction.OpenBranchProc(main.WrapperID, data.InstanceID);
        }
Ejemplo n.º 8
0
        public QueryResult LoadRecord()
        {
            var result = new QueryResult();

            var urlName = HttpUtility.UrlEncode(Username);
            var zone    = IsSouth ? "south" : "north";
            var json    = WebInteraction.GET(GET_LOGIN_URL + "name=" + urlName + "&zone=" + zone);

            // "account_db_id":"1837225125"
            if (json == @"{""errno"":2}")
            {
                throw new Exception("UserNotExits");
            }
            Aid = Regex.Match(json, @"(?<=""account_db_id"":"")\d{10}(?="")").Value;

            var shipInfo = WebInteraction.GET(SHIP_INFO_URL + "aid=" + Aid);
            var ships    = Ships.GetShips();

            //var shipInfos = new Dictionary<int, ShipInfo>();
            var shipCounts = new int[10];
            var shipPov    = new int[10];

            var    reader = new JsonTextReader(new StringReader(shipInfo));
            string thisId = "";

            while (reader.Read())
            {
                var match = Regex.Match(reader.Path, @"\[(\d+?)]\.(.+)");
                if (match.Groups[2].Value == "id.vehicleTypeCd")
                {
                    thisId = reader.ReadAsString();
                }
                if (match.Groups[2].Value == "battles")
                {
                    var lvl     = ships[thisId].Lvl;
                    var type    = ships[thisId].Type;
                    var battles = reader.ReadAsInt32().Value;
                    shipCounts[--lvl] += battles;
                    switch (type)
                    {
                    case "Cruiser":
                        result.CA += battles;
                        break;

                    case "AirCarrier":
                        result.CV += battles;
                        break;

                    case "Destroyer":
                        result.DD += battles;
                        break;

                    case "Battleship":
                        result.BB += battles;
                        break;
                    }
                }
                if (match.Groups[2].Value == "wins")

                {
                    var lvl = ships[thisId].Lvl;
                    shipPov[--lvl] += reader.ReadAsInt32().Value;
                }
            }

            result.LvlShipCount  = shipCounts;
            result.LvlShipVicPer = shipPov;

            return(result);
        }