Exemplo n.º 1
0
        /// <summary>
        ///     Moves to the first control
        /// </summary>
        public override void MoveFirst(bool autoMove = true)
        {
            // Clear results before going back
            ResultArray.Clear();

            base.MoveFirst(autoMove);
        }
Exemplo n.º 2
0
 public static void FixCurvesSelfIntersection(List <Curve> curves)
 {
     for (int x = 0; x < curves.Count; x++)
     {
         for (int y = x + 1; y < curves.Count; y++)
         {
             var c1 = curves[x];
             var c2 = curves[y];
             IntersectionResultArray ResultArray;
             var result = c1.Intersect(c2, out ResultArray);
             if (result == SetComparisonResult.Overlap)
             {
                 var interResult = ResultArray.get_Item(0);  // опасный ход, но вроде должны быть только пересекающиеся линии
                 if (!IsSamePoint(interResult.XYZPoint, c1.GetEndPoint(0)) &&
                     !IsSamePoint(interResult.XYZPoint, c1.GetEndPoint(1)))
                 {
                     // производим некий аналог Trim, оставляя линии подлинеее
                     var temp1A = Line.CreateBound(c1.GetEndPoint(0), interResult.XYZPoint);
                     var temp1B = Line.CreateBound(c1.GetEndPoint(1), interResult.XYZPoint);
                     var temp2A = Line.CreateBound(c2.GetEndPoint(0), interResult.XYZPoint);
                     var temp2B = Line.CreateBound(c2.GetEndPoint(1), interResult.XYZPoint);
                     var new_c1 = temp1A.Length > temp1B.Length ? temp1A : temp1B;
                     var new_c2 = temp2A.Length > temp2B.Length ? temp2A : temp2B;
                     curves[x] = new_c1;
                     curves[y] = new_c2;
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
        public IActionResult List([FromBody] QueryArrayModel paras)
        {
            ResultArray <SystemConfig> result  = new ResultArray <SystemConfig>();
            IQueryable <SystemConfig>  allList = null;

            allList = _dbContext.SystemConfig.Where(m => (string.IsNullOrEmpty(paras.Code) ? true :
                                                          m.Key.Contains(paras.Code) ||
                                                          m.Name.Contains(paras.Code) ||
                                                          m.Value.Contains(paras.Code) ||
                                                          m.Memo.Contains(paras.Code)));
            result.total   = allList.Count();
            result.success = true;
            result.data    = allList.Skip((paras.PageIndex - 1) * paras.PageSize).Take(paras.PageSize).ToList();
            return(Json(result));
        }
Exemplo n.º 4
0
        public override bool OnUnloaded(bool forceExit)
        {
            bool exit;

            var analyze = CurrentControl as Analyze;

            if (analyze != null)
            {
                exit = forceExit ||
                       MessageBox.Show("Would you like to cancel the scan that's in progress?", Utils.ProductName,
                                       MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes;

                if (exit)
                {
                    analyze.AbortScanThread();
                    ResultArray.Clear();

                    return(true);
                }
                return(false);
            }

            if (!(CurrentControl is Results))
            {
                return(true);
            }

            exit = forceExit ||
                   MessageBox.Show("Would you like to cancel?", Utils.ProductName, MessageBoxButton.YesNo,
                                   MessageBoxImage.Question) == MessageBoxResult.Yes;

            if (!exit)
            {
                return(false);
            }

            ResultArray.Clear();

            return(true);
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            int[,] FirsArrayForSum    = { { 2, 4 }, { 3, 6 }, { 7, 4 } };
            int[,] SecondArrayForSum  = { { 3, 5 }, { 6, 4 }, { 3, 7 } };
            int[,] FirsArrayForMult   = { { 2, 4 }, { 3, 6 }, { 7, 4 } };
            int[,] SecondArrayForMult = { { 3, 5, 6 }, { 4, 3, 7 } };
            int[,] ResultArray;

            ResultArray = MyArray.GetSum(FirsArrayForSum, SecondArrayForSum);
            Debug.WriteLine("\nThe array after Sum:");
            for (int i = 0; i < ResultArray.GetUpperBound(0) + 1; i++)
            {
                Debug.WriteLine("");
                for (int j = 0; j < ResultArray.GetUpperBound(1) + 1; j++)
                {
                    Debug.Write($"{ResultArray[i,j]} ");
                }
            }
            ResultArray = MyArray.GetSub(FirsArrayForSum, SecondArrayForSum);
            Debug.WriteLine("\nThe array after Sub:");
            for (int i = 0; i < ResultArray.GetUpperBound(0) + 1; i++)
            {
                Debug.WriteLine("");
                for (int j = 0; j < ResultArray.GetUpperBound(1) + 1; j++)
                {
                    Debug.Write($"{ResultArray[i, j]} ");
                }
            }
            ResultArray = MyArray.GetMultiply(FirsArrayForMult, SecondArrayForMult);
            Debug.WriteLine("\nThe array after Multiply:");
            for (int i = 0; i < ResultArray.GetUpperBound(0) + 1; i++)
            {
                Debug.WriteLine("");
                for (int j = 0; j < ResultArray.GetUpperBound(1) + 1; j++)
                {
                    Debug.Write($"{ResultArray[i, j]} ");
                }
            }
        }
Exemplo n.º 6
0
        public IActionResult UserList([FromBody] QueryArrayModel paras)
        {
            var result = new ResultArray <Dictionary <string, object> >();
            IQueryable <SystemUser> allList = null;

            allList        = _dbContext.SystemUser.Where(m => (string.IsNullOrEmpty(paras.Code) ? true : (m.Name.Contains(paras.Code) || m.Code.Contains(paras.Code))));
            result.total   = allList.Count();
            result.success = true;
            result.data    = new List <Dictionary <string, object> >();
            foreach (var item in allList.Skip((paras.PageIndex - 1) * paras.PageSize).Take(paras.PageSize))
            {
                var info     = Common.ToDictionary(item);
                var lastInfo = _dbContext.LoginRecord.LastOrDefault(m => m.UserId == item.Id);
                if (lastInfo != null)
                {
                    info.Add("lastTime", lastInfo.LoginTime.ToString("yyyy-MM-dd HH:mm:ss"));
                    info.Add("lastIp", lastInfo.Address);
                    info.Add("loginCount", _dbContext.LoginRecord.Count(m => m.UserId == item.Id).ToString());
                }
                result.data.Add(info);
            }
            return(Json(result));
        }
Exemplo n.º 7
0
 public NumberController(ResultArray resultArray)
 {
     _resultArray = resultArray;
 }
Exemplo n.º 8
0
 public static string ToJson <T>(this ResultArray <T> model)
 {
     return(JsonConvert.SerializeObject(model));
 }