Inheritance: MonoBehaviour
示例#1
0
        public void Click_item(ToolModel item)
        {
            try
            {
                var check = MToolList.Where(a => a.MToolColor == AppSettings.MainColor).ToList();
                if (check.Count > 0)
                {
                    foreach (var all in check)
                    {
                        all.MToolColor = "#212121";
                    }
                }

                var click = MToolList.FirstOrDefault(a => a.MToolType == item.MToolType);
                if (click != null)
                {
                    click.MToolColor = AppSettings.MainColor;
                }

                NotifyDataSetChanged();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
示例#2
0
        public async void CreatePostAndVerifyOk()
        {
            var client  = GetClient();
            var request = new RestRequest();

            request.Method   = Method.POST;
            request.Resource = "api/tools/";
            request.AddHeader("Accept", "application/json");
            string modelNumber = "TL" + RandomNumberHelper.NextInteger();
            var    theTool     = new ToolModel {
                Name = "A Power Tool", ModelNumber = modelNumber
            };

            request.AddJsonBody(theTool);
            var response = await client.Execute(request);

            Assert.NotNull(response);
            Assert.NotNull(response.Content);
            Assert.True(response.StatusCode == HttpStatusCode.Created);

            var toolModelRequest = new RestRequest
            {
                Method   = Method.GET,
                Resource = $"api/tools/{modelNumber}"
            };

            toolModelRequest.AddHeader("Accept", "application/json");
            toolModelRequest.AddParameter("GetBy", "ModelNumber", ParameterType.HttpHeader);
            var toolIdResponse = await client.Execute <ToolModel>(toolModelRequest);

            Assert.True(toolIdResponse.IsSuccess);
            _host.Dispose();
        }
示例#3
0
 void  updata()
 {
     try
     {
         for (int i = 0; i <= dt_showdata.Items.Count; i++)
         {
             var         cntr   = dt_showdata.ItemContainerGenerator.ContainerFromIndex(i);
             DataGridRow ObjROw = (DataGridRow)cntr;
             if (ObjROw != null)
             {
                 FrameworkElement objElement = dt_showdata.Columns[0].GetCellContent(ObjROw);
                 if (objElement != null)
                 {
                     System.Windows.Controls.CheckBox objChk = (System.Windows.Controls.CheckBox)objElement;
                     if (objChk.IsChecked == true)
                     {
                         ToolModel tm = ObjROw.Item as ToolModel;
                         //if (tm == null)
                         //    continue;
                         // _toolmodellist.Remove(tm);
                         int index = _toolmodellist.FindIndex(p => p.wrenchBarCode == tm.wrenchBarCode);
                         _toolmodellist.RemoveAt(index);
                     }
                 }
             }
         }
         // dgbind(_toolmodellist);
     }
     catch
     {
         return;
     }
 }
示例#4
0
        ToolModel GetToolMode(wrench w)
        {
            ToolModel    tm = null;
            wrenchstatus ws = WrenchStatus.selectByguid(w.status);

            if (ws == null || ws.guid == null)
            {
                return(tm);
            }
            tm = new ToolModel()
            {
                wrenchBarCode = w.wrenchBarCode,
                wrenchCode    = w.wrenchCode,
                comment       = w.comment,
                createDate    = w.createDate,
                cycletime     = Convert.ToDecimal(w.cycletime.ToString("f0")),
                factory       = w.factory,
                guid          = w.guid,
                id            = w.id,
                IP            = w.IP,
                isallowcheck  = w.isallowcheck,
                lastrepair    = w.lastrepair,
                port          = w.port,
                rangeMax      = w.rangeMax,
                rangeMin      = w.rangeMin,
                species       = w.species,
                status        = w.status,
                statusName    = ws.statusName,
                targetvalue   = w.targetvalue,
                unit          = w.unit
            };
            return(tm);
        }
示例#5
0
        void GetBycontion(Dictionary <string, string> contion)
        {
            List <wrench> wrenchs = Wrench.selectByContion(contion);

            if (wrenchs == null || wrenchs.Count < 0)
            {
                MessageAlert.Alert("没有该工具信息!");
                return;
            }
            foreach (wrench w in wrenchs)
            {
                if (wrenchRepairList.FindIndex(p => p.wrenchBarCode == w.wrenchBarCode) < 0)
                {
                    ToolModel e = GetToolModel(w);
                    wrenchRepairList.Add
                    (
                        new WrenchRepairBind()
                    {
                        wrenchCode       = e.wrenchCode,
                        wrenchBarCode    = e.wrenchBarCode,
                        wrenchParentName = e.speciesName,
                        isCheck          = true,
                        lastRepair       = e.lastrepair,
                        days             = e.cycletime.ToString("f0"),
                        isNeedCheck      = e.isallowcheck,
                        guid             = e.guid
                    }
                    );
                    // _toolmodellist.Add(e);
                }
            }
            return;
        }
        private void deinitModels()
        {
            if (null != mActionBarM)
            {
                mActionBarM.deinit();
                mActionBarM = null;
            }

            if (null != mToolM)
            {
                mToolM.deinit();
                mToolM = null;
            }

            if (null != mFirmwareM)
            {
                mFirmwareM.deinit();
                mFirmwareM = null;
            }

            if (null != mTemplateRootM)
            {
                mTemplateRootM.deinit();
                mTemplateRootM = null;
            }

            if (null != mLogM)
            {
                mLogM.deinit();
                mLogM = null;
            }
        }
        private void initModels()
        {
            if (null == mLogM)
            {
                mLogM = new LogModel();
                mLogM.init(this);
            }

            if (null == mTemplateRootM)
            {
                mTemplateRootM = new TemplateRootModel();
                mTemplateRootM.init(this);
            }

            if (null == mFirmwareM)
            {
                mFirmwareM = new FirmwareModel();
                mFirmwareM.init(this);
            }

            if (null == mToolM)
            {
                mToolM = new ToolModel();
                mToolM.init(this);
            }

            if (null == mActionBarM)
            {
                mActionBarM = new ActionBarModel();
                mActionBarM.init(this);
            }
        }
示例#8
0
        public void addToolItem(ToolModel toolModel)
        {
            if (toolModes == null)
            {
                toolModes = new Dictionary <string, ToolModel>();
            }
            if (!toolModes.ContainsKey(toolModel.Id))
            {
                toolModes.Add(toolModel.Id, toolModel);
            }
            GameObject obj = ResourceManager.getInstance().loadUISpawnPool(toolModePrefab, null);

            toolModel.ToolMenuItem = obj;
            obj.name = toolModel.Id;
            UIEventListener.Get(obj).onClick += toolMenuItemClick;
            UISprite toolIcon = obj.transform.Find("toolIcon").GetComponent <UISprite>();

            toolIcon.atlas      = atlas;
            toolIcon.spriteName = toolModel.SpriteName;
            toolIcon.MakePixelPerfect();
            obj.transform.Find("toolName").GetComponent <UILabel>().text = toolModel.Name;
            grid.AddChild(obj.transform);
            obj.transform.localPosition = Vector3.zero;
            grid.repositionNow          = true;
            grid.Reposition();
            scrollBar.value = 0;
        }
示例#9
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var user = await _context.GetUserLightAsync(User);

            if (user == null)
            {
                return(NotFound());
            }

            var tool = user.Tools.SingleOrDefault(t => t.Id == id);

            if (tool == null)
            {
                return(NotFound());
            }

            var client = await _identityContext.Clients
                         .Include(c => c.ClientSecrets)
                         .SingleOrDefaultAsync(c => c.Id == tool.IdentityServerClientId);

            if (client == null)
            {
                return(NotFound());
            }

            Tool = new ToolModel(Request.HttpContext, tool, client);

            return(Page());
        }
示例#10
0
    public List <ToolModel> getTools()
    {
        List <ToolModel> mList = new List <ToolModel>();
        string           sql   = "select * from railway_toolbase";
        DataTable        tb    = MysqlHelper.ExecuteDataTable(sql);

        if (tb.Rows.Count > 0)
        {
            for (int i = 0; i < tb.Rows.Count; i++)
            {
                DataRow   dr   = tb.Rows[i];
                ToolModel tool = new ToolModel();
                tool.Index      = Int32.Parse(dr["seq"].ToString());
                tool.Name       = dr["name"].ToString();
                tool.SpriteName = dr["pathname"].ToString();
                if (tool.SpriteName == null || tool.SpriteName.Equals(""))
                {
                    continue;
                }
                tool.Id = dr["id"].ToString();
                mList.Add(tool);
            }
        }
        else
        {
            MysqlHelper.CloseConn();
            return(null);
        }
        MysqlHelper.CloseConn();
        return(mList);
    }
示例#11
0
        // Update tool Selection
        private void ToolDataGrid_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
        {
            if (ToolDataGrid.SelectedIndex != -1)
            {
                // Get toolData from ToolDataGrid
                ToolModel selectedTool = (ToolModel)ToolDataGrid.SelectedItems[0];

                // Get toolID from toolData
                toolID = selectedTool.ToolID;

                // Load ToolData from SQLite DB
                var toolData = SqliteDataAcces.LoadToolDataByID(toolID);

                // Fill tool information
                functionTextBlock.Text = toolData.Function;
                typeTextBlock.Text     = toolData.Type;
                holderTextBlock.Text   = toolData.Holder;
                machineTextBlock.Text  = toolData.Machine;
                diameterTextBlock.Text = toolData.Diameter.ToString("F");
                lengthTextBlock.Text   = toolData.Length.ToString("F");
                storageTextBlock.Text  = toolData.Storage;
                locationTextBlock.Text = toolData.Location;

                holderVendorTextBlock.Text = toolData.HolderVendor;
                holderArtTextBlock.Text    = toolData.HolderArt;

                extensionVendorTextBlock.Text = toolData.ExtensionVendor;
                extensionArtTextBlock.Text    = toolData.ExtensionArt;

                toolVendorTextBlock.Text = toolData.ToolVendor;
                toolArtTextBlock.Text    = toolData.ToolArt;
            }
        }
示例#12
0
        public async Task <ToolModel> GetTool([FromUri] int toolId)
        {
            Tool tool = await this._toolManager.GetTool(toolId);

            ToolModel model = tool.ConvertTool();

            return(model);
        }
示例#13
0
        private static ToolModel ParseTool(MySqlDataReader reader)
        {
            var c = new ToolModel();

            c.id       = (int)(long)reader["id"];
            c.toolName = (string)reader["toolName"];
            return(c);
        }
示例#14
0
    ToolModel CreateTool(ToolModel model)
    {
        ToolModel tool_model = Instantiate(model, transform.position, transform.rotation)
                               as ToolModel;

        tool_model.gameObject.SetActive(true);
        return(tool_model);
    }
示例#15
0
 private void Awake()
 {
     toolModelObject   = GameObject.Find("ToolModel");
     toolModel         = toolModelObject.GetComponent <ToolModel>();
     spriteRenderer    = GetComponent <SpriteRenderer>();
     toolCollider      = GetComponent <BoxCollider2D>();
     toolCollider.size = new Vector2();
 }
示例#16
0
    /** Creates a ToolModel instance. */
    protected ToolModel CreateTool(ToolModel model)
    {
        ToolModel tool_model = Instantiate(model, transform.position, transform.rotation) as ToolModel;

        tool_model.gameObject.SetActive(true);
        Leap.Utils.IgnoreCollisions(tool_model.gameObject, gameObject);
        return(tool_model);
    }
示例#17
0
 private ToolModel CreateTool(ToolModel model)
 {
     ToolModel tool_model = Instantiate(model, transform.position, transform.rotation)
                        as ToolModel;
     tool_model.gameObject.SetActive(true);
     IgnoreCollisionsWithChildren(tool_model.gameObject);
     return tool_model;
 }
示例#18
0
    ToolModel CreateTool(ToolModel model)
    {
        ToolModel tool_model = Instantiate(model, transform.position, transform.rotation)
                               as ToolModel;

        tool_model.gameObject.SetActive(true);
        IgnoreCollisionsWithChildren(tool_model.gameObject);
        return(tool_model);
    }
示例#19
0
        private ToolModel ParseTools(MySqlDataReader reader)
        {
            var tools = new ToolModel();

            tools.id       = (int)(long)reader["id"];
            tools.toolName = (string)reader["toolName"];

            return(tools);
        }
示例#20
0
        private void AddButtonToPanel(FlowLayoutPanel panel, ToolModel toolModel)
        {
            ToolButton buttonTool = new ToolButton();

            buttonTool.Text   = toolModel.TextButton;
            buttonTool.Action = toolModel.ActionButton;
            buttonTool.Click += ButtonTool_Click;
            panel.Controls.Add(buttonTool);
        }
示例#21
0
        public async void CreateUpdateAndVerify()
        {
            var client = GetClient();

            var postRequest = new RestRequest();

            postRequest.Method   = Method.POST;
            postRequest.Resource = "api/tools/";
            postRequest.AddHeader("Accept", "application/json");
            string modelNumber = "TL" + RandomNumberHelper.NextInteger();
            var    theTool     = new ToolModel {
                Name = "A Power Tool", ModelNumber = modelNumber
            };

            postRequest.AddJsonBody(theTool);
            var postResponse = await client.Execute(postRequest);

            Assert.NotNull(postResponse);
            Assert.NotNull(postResponse.Content);
            Assert.True(postResponse.StatusCode == HttpStatusCode.Created);

            _logger.LogDebug($"Created test tool for model id: {modelNumber}");

            var toolModelRequest = new RestRequest
            {
                Method   = Method.GET,
                Resource = $"api/tools/{modelNumber}"
            };

            toolModelRequest.AddHeader("Accept", "application/json");
            toolModelRequest.AddParameter("QueryBy", "ModelNumber", ParameterType.HttpHeader);
            var toolModelResponse = await client.Execute <ToolModel>(toolModelRequest);

            Assert.True(toolModelResponse.IsSuccess);

            _logger.LogDebug($"Retrieved test tool with an id of: {toolModelResponse.Data.ToolId}");

            var updateRequest = new RestRequest();

            updateRequest.Method   = Method.PUT;
            updateRequest.Resource = $"api/tools/{toolModelResponse.Data.ToolId}";
            updateRequest.AddHeader("Accept", "application/json");
            var theUpdatedTool = toolModelResponse.Data;

            theUpdatedTool.Name = "A Power Tool (UPDATED)";
            updateRequest.AddJsonBody(theUpdatedTool);
            var updateResponse = await client.Execute(updateRequest);

            Assert.NotNull(updateResponse);
            Assert.NotNull(updateResponse.Content);
            Assert.True(updateResponse.StatusCode == HttpStatusCode.OK);

            _logger.LogDebug($"Updated test tool with an id of: {theUpdatedTool.ToolId}");

            _host.Dispose();
        }
示例#22
0
        // GET: Tools/Create
        public ActionResult Create()
        {
            if (HttpContext.Session.GetInt32("_Id") == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            var model = new ToolModel();

            return(View(model));
        }
示例#23
0
    public static ToolModel ConvertTool(this Tool tool)
    {
        ToolModel model = Mapper.Map <ToolModel>(tool);

        model.Category = tool.Category.Name;
        model.License  = Enum.GetName(typeof(License), tool.License);
        model.Type     = Enum.GetName(typeof(ToolType), tool.Type);
        model.OSs      = tool.OperatingSystems.Select(o => o.Name).ToArray();
        return(model);
    }
 private static void DefineToolToToolModelMapping()
 {
     MapperObject.AddMap <Tool, ToolModel>(src =>
     {
         var res = new ToolModel();
         res.InjectFrom(src);
         res.TenantDomain = src.DomainId;
         return(res);
     });
 }
示例#25
0
        //UA模拟
        private static void replaceUserAgent(Session session)
        {
            ToolModel userAgent = Main.mainData.getToolByType("useragent");

            if (userAgent.Enable && userAgent.Content.Length > 0)
            {
                session.RequestHeaders.Remove("User-Agent");
                session.RequestHeaders.Add("User-Agent", userAgent.Content);
            }
        }
示例#26
0
        public IActionResult OnGet()
        {
            // Create the Client for this tool registration
            Tool = new ToolModel(Request.HttpContext)
            {
                ClientId     = CryptoRandom.CreateUniqueId(8),
                DeploymentId = CryptoRandom.CreateUniqueId(8)
            };

            return(Page());
        }
示例#27
0
        private void AcceptInput(object sender, RoutedEventArgs e)
        {
            if (!inputCorrect)
            {
                MessageBox.Show("Description field can't be empty.", "Invalid description input", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
            else
            {
                // create new tool instance
                ToolModel updateTool = new ToolModel();


                if (SqliteDataAcces.SearchDataByText("ToolID", "Tools", "ToolID", toolID).ToList().Count == 0)
                {
                    MessageBox.Show("Tool not found in database.", "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
                else
                {
                    // Assign info to updateTool
                    updateTool.ToolID          = Convert.ToInt32(toolID);
                    updateTool.Storage         = StorageTextBox.Text;
                    updateTool.Location        = LocationTextBox.Text;
                    updateTool.Description     = DescriptionTextBox.Text;
                    updateTool.HolderVendor    = HolderVendorComboBox.Text;
                    updateTool.HolderArt       = HolderArtTextBox.Text;
                    updateTool.ExtensionVendor = ExtensionVendorComboBox.Text;
                    updateTool.ExtensionArt    = ExtensionArtTextBox.Text;
                    updateTool.ToolVendor      = ToolVendorComboBox.Text;
                    updateTool.ToolArt         = ToolArtTextBox.Text;



                    // Write new tool to Database and check if succesfull
                    bool writingSuccesFull = SqliteDataAcces.UpdateToolRecord(updateTool);

                    if (writingSuccesFull)
                    {
                        MessageBox.Show($"Changes succesfully written to database.", "Succesfull", MessageBoxButton.OK, MessageBoxImage.Information);

                        //Close window
                        raiseClosingEvent = false;
                        Close();

                        //Refresh data grid
                        ((MainWindow)Owner).SetDataGrid();
                    }
                    else
                    {
                        MessageBox.Show($"Failed update tool!", "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    }
                }
            }
        }
示例#28
0
        public void SaveDummyModel()
        {
            //given --
            DynamicFormModel dynamicModel     = new DynamicFormModel();
            ToolModel        toolModelNotePad = new ToolModel(textButton: "run", actionButton: "notepad.exe");
            ToolModel        toolModelBrowser = new ToolModel(textButton: "navigate", actionButton: "www.google.com");

            dynamicModel.ToolModels = new[] { toolModelNotePad, toolModelBrowser };

            //when
            DynamicFormModelSerializer.WriteToXmlFile(dynamicModel, path: "Z:\\config.xml");
        }
示例#29
0
    public static ToolModel[] ConvertTools(this Tool[] tools)
    {
        ToolModel[] models = new ToolModel[tools.Length];
        int         i      = 0;

        foreach (Tool tool in tools)
        {
            models[i] = tool.ConvertTool();
            i++;
        }
        return(models);
    }
        private void Bt_print_Click(object sender, RoutedEventArgs e)
        {
            if (dataGrid1.SelectedItems.Count > 0)
            {
                printModel = (ToolModel)dataGrid1.SelectedItem;

                PrintItem();
            }
            else
            {
                MessageBox.Show("请选中要打印条码的工具行!");
            }
        }
示例#31
0
 public DocumentGenerationResult Generate(SiteContext ctx)
 {
     return(new()
     {
         Name = "vex",
         Template = "/ARKTools/vex.cshtml",
         Model = new ToolModel(ctx)
         {
             SiteName = "ARK Tools",
             DisplayTitle = "Vex",
         },
     });
 }
        public ToolboxViewModel(IUnityContainer container, AbstractWorkspace workspace, ToolboxModel model)
        {
            _workspace = workspace;
            _container = container;
            Name = "Toolbox";
            Title = "Toolbox";
            ContentId = "Toolbox";
            _model = model;
            Model = _model;
            IsVisible = false;

            _view = container.Resolve<ToolboxView>();
            _view.DataContext = _model;
            View = _view;

            _aggregator = _container.Resolve<IEventAggregator>();
        }
示例#33
0
    /**
      * Updates tools based on tracking data in the specified Leap ToolList object.
      * Active ToolModel instances are updated if the tool they represent is still
      * present in the Leap ToolList; otherwise, the ToolModel is removed. If new
      * Leap Tool objects are present in the Leap ToolList, new ToolModels are
      * created and added to the HandController tool list.
      * @param all_tools The dictionary containing the ToolModels to update.
      * @param leap_tools The list of tools from the a Leap Frame instance.
      * @param model The ToolModel instance to use for new tools.
      */
    protected void UpdateToolModels(Dictionary<int, ToolModel> all_tools,
                                  ToolList leap_tools, ToolModel model)
    {
        List<int> ids_to_check = new List<int>(all_tools.Keys);

        // Go through all the active tools and update them.
        int num_tools = leap_tools.Count;
        for (int h = 0; h < num_tools; ++h) {
          Tool leap_tool = leap_tools[h];

          // Only create or update if the tool is enabled.
          if (model) {

        ids_to_check.Remove(leap_tool.Id);

        // Create the tool and initialized it if it doesn't exist yet.
        if (!all_tools.ContainsKey(leap_tool.Id)) {
          ToolModel new_tool = CreateTool(model);
          new_tool.SetController(this);
          new_tool.SetLeapTool(leap_tool);
          new_tool.InitTool();
          all_tools[leap_tool.Id] = new_tool;
        }

        // Make sure we update the Leap Tool reference.
        ToolModel tool_model = all_tools[leap_tool.Id];
        tool_model.SetLeapTool(leap_tool);
        tool_model.MirrorZAxis(mirrorZAxis);

        // Set scaling.
        tool_model.transform.localScale = Vector3.one;

        tool_model.UpdateTool();
          }
        }

        // Destroy all tools with defunct IDs.
        for (int i = 0; i < ids_to_check.Count; ++i) {
          Destroy(all_tools[ids_to_check[i]].gameObject);
          all_tools.Remove(ids_to_check[i]);
        }
    }
示例#34
0
 /** Creates a ToolModel instance. */
 protected ToolModel CreateTool(ToolModel model)
 {
     ToolModel tool_model = Instantiate(model, transform.position, transform.rotation) as ToolModel;
     tool_model.gameObject.SetActive(true);
     Leap.Utils.IgnoreCollisions(tool_model.gameObject, gameObject);
     return tool_model;
 }