Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("PrintColorID,Name,Description,IsActive,AddedDate,UpdatedDate,AddedUserID,UpdatedUserID")] PrintColor printColor)
        {
            if (id != printColor.PrintColorID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    printColor.UpdatedDate   = DateTime.Now;
                    printColor.UpdatedUserID = Int32.Parse(HttpContext.Session.GetString("UserID"));
                    _context.Update(printColor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PrintColorExists(printColor.PrintColorID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AddedUserID"]   = new SelectList(_context.Users, "UserID", "Login", printColor.AddedUserID);
            ViewData["UpdatedUserID"] = new SelectList(_context.Users, "UserID", "Login", printColor.UpdatedUserID);
            return(View(printColor));
        }
        private static PrintColorViewModel ReturnPrintColorViewModel(PrintColor printColor)
        {
            PrintColorViewModel printColorViewModel = new PrintColorViewModel()
            {
                ID       = printColor.ID,
                Name     = printColor.Name,
                HexValue = printColor.HexValue,
            };

            return(printColorViewModel);
        }
 public static async Task <PrintColorViewModel> SearchByName(string searchText = null)
 {
     if (searchText != null)
     {
         PrintColor printColor = (await App.MobileService.GetTable <PrintColor>().Where(pc => pc.Name.Contains(searchText)).ToListAsync()).FirstOrDefault();
         return(ReturnPrintColorViewModel(printColor));
     }
     else
     {
         return(null);
     }
 }
        public static async Task Insert(PrintColorViewModel printColorViewModel)
        {
            var printColor = new PrintColor()
            {
                ID       = printColorViewModel.ID,
                Name     = printColorViewModel.Name,
                HexValue = printColorViewModel.HexValue,
            };
            await App.MobileService.GetTable <PrintColor>().InsertAsync(printColor);

            //await App.MobileService.SyncContext.PushAsync();
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Create([Bind("PrintColorID,Name,Description,IsActive,AddedDate,UpdatedDate,AddedUserID,UpdatedUserID")] PrintColor printColor)
        {
            if (ModelState.IsValid)
            {
                printColor.IsActive    = true;
                printColor.AddedDate   = DateTime.Now;
                printColor.AddedUserID = Int32.Parse(HttpContext.Session.GetString("UserID"));
                _context.Add(printColor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AddedUserID"]   = new SelectList(_context.Users, "UserID", "Login", printColor.AddedUserID);
            ViewData["UpdatedUserID"] = new SelectList(_context.Users, "UserID", "Login", printColor.UpdatedUserID);
            return(View(printColor));
        }
Ejemplo n.º 6
0
        public bool PrintString(string sString, PrintColor iColor = PrintColor.White)
        {
            if (!IsIngame())
            {
                return(false);
            }

            if (!WriteWString(sString))
            {
                throw new Exception("PrintString: Failed to write string.");
            }

            try {
                RemoteThread(g_pD2InjectPrint, (IntPtr)iColor);
            } catch {
                throw new Exception("PrintString: Failed to create remote thread.");
            }

            return(true);
        }
Ejemplo n.º 7
0
        public static void Print(string output, PrintColor color)
        {
            switch (color)
            {
            case PrintColor.YELLOW:
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine(output);
                Console.ResetColor();
                break;

            case PrintColor.GREEN:
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine(output);
                Console.ResetColor();
                break;

            case PrintColor.RED:
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(output);
                Console.ResetColor();
                break;
            }
        }
Ejemplo n.º 8
0
 public PrintPen(float width, float[] dashStyle, PrintColor color)
 {
     this.Width = width;
     this.DashStyle = dashStyle;
     this.Color = color;
 }
 public void PrintTest()
 {
     PrintColor.Print("123", 2);
 }
 /// <summary>
 /// 画文字
 /// </summary>
 /// <param name="startX">文字起始x坐标</param>
 /// <param name="startY">文字起始y坐标</param>
 /// <param name="width">文字绘制区域宽度(可以为0,不为0的时候文字需要根据宽度自动换行)</param>
 /// <param name="height">文字绘制区域高度(可以为0)</param>
 /// <param name="text">内容</param>
 /// <param name="fontSize">字体大小</param>
 /// <param name="textStyle">字体样式</param>
 /// <param name="color">文字颜色</param>
 /// <param name="rotation">旋转角度</param>
 public IBluetoothPrinterProtocol DrawText(int startX, int startY, int width, int height, string text, FontSize fontSize,
                                           TextStyle textStyle, PrintColor color, RotationAngle rotation)
 {
     return(DrawText(startX, startY, width, height, text, (int)fontSize, (int)textStyle, (int)color,
                     (int)rotation));
 }
        public static async Task <PrintColorViewModel> SearchByID(string ID)
        {
            PrintColor printColor = (await App.MobileService.GetTable <PrintColor>().Where(pc => pc.ID.Contains(ID)).ToListAsync()).FirstOrDefault();

            return(ReturnPrintColorViewModel(printColor));
        }