Пример #1
0
        public override void BuildLayout(SingleContainer editorContainer, IAssetManager assetManager)
        {
            this.m_FileSelect = new FileSelect {
                Path = this.m_Asset.SourcePath
            };
            this.m_FileSelect.Changed += (sender, e) =>
            {
                this.m_Asset.SourcePath = this.m_FileSelect.Path;
                using (var stream = new StreamReader(this.m_Asset.SourcePath, Encoding.UTF8))
                {
                    this.m_Asset.Value = stream.ReadToEnd();
                }
                assetManager.Save(this.m_Asset);
            };

            var form = new Form();

            form.AddControl("Source File:", this.m_FileSelect);

            var vertContainer = new VerticalContainer();

            vertContainer.AddChild(form, "*");

            editorContainer.SetChild(vertContainer);
        }
Пример #2
0
        public override void BuildLayout(SingleContainer editorContainer, IAssetManager assetManager)
        {
            this.m_FileSelect          = new FileSelect();
            this.m_FileSelect.Changed += (sender, e) =>
            {
                using (var stream = new FileStream(this.m_FileSelect.Path, FileMode.Open))
                {
                    using (var reader = new BinaryReader(stream))
                    {
                        this.m_Asset.RawData = reader.ReadBytes((int)stream.Length);
                    }
                }
                assetManager.Recompile(this.m_Asset);
                assetManager.Save(this.m_Asset);
            };

            var form = new Form();

            form.AddControl("Source File:", this.m_FileSelect);

            //var textureViewer = new TextureViewer();
            //textureViewer.Texture = this.m_Asset;

            var vertContainer = new VerticalContainer();

            vertContainer.AddChild(form, "*");
            //vertContainer.AddChild(textureViewer, "400");

            editorContainer.SetChild(vertContainer);
        }
Пример #3
0
    public void CanRoundtripSingleContainer()
    {
        var it = new SingleContainer(new SyncedDir("path", new Uri("https://example.com")));

        var result = Roundtrip(it);
        var single = Assert.IsType <SingleContainer>(result);

        Assert.Equal(it.SyncedDir, single.SyncedDir);
    }
Пример #4
0
        public override void BuildLayout(SingleContainer editorContainer, IAssetManager assetManager)
        {
            this.m_TextBox = new TextBox {
                Text = this.m_Asset.Value
            };
            this.m_TextBox.TextChanged += (sender, e) =>
            {
                this.m_Asset.Value = this.m_TextBox.Text;
                assetManager.Save(this.m_Asset);
            };

            var form = new Form();

            form.AddControl("English:", this.m_TextBox);
            editorContainer.SetChild(form);
        }
Пример #5
0
        public override void BuildLayout(SingleContainer editorContainer, IAssetManager assetManager)
        {
            this.m_TextureAssetName = new TextBox {
                Text = this.m_Asset.TextureName
            };
            this.m_TextureAssetName.TextChanged += (sender, e) =>
            {
                if (assetManager.TryGet <TextureAsset>(this.m_TextureAssetName.Text) != null)
                {
                    this.m_Asset.TextureName = this.m_TextureAssetName.Text;
                    assetManager.Save(this.m_Asset);
                }
            };
            this.m_CellWidth = new TextBox {
                Text = this.m_Asset.CellWidth.ToString()
            };
            this.m_CellWidth.TextChanged += (sender, e) =>
            {
                try
                {
                    this.m_Asset.CellWidth = Convert.ToInt32(this.m_CellWidth);
                    assetManager.Save(this.m_Asset);
                }
                catch { }
            };
            this.m_CellHeight = new TextBox {
                Text = this.m_Asset.CellHeight.ToString()
            };
            this.m_CellHeight.TextChanged += (sender, e) =>
            {
                try
                {
                    this.m_Asset.CellHeight = Convert.ToInt32(this.m_CellHeight);
                    assetManager.Save(this.m_Asset);
                }
                catch { }
            };

            var form = new Form();

            form.AddControl("Texture Name:", this.m_TextureAssetName);
            form.AddControl("Cell Width:", this.m_CellWidth);
            form.AddControl("Cell Height:", this.m_CellHeight);

            editorContainer.SetChild(form);
        }
Пример #6
0
        //更新许可证VIN数据GoodslimitVin
        public int UpdateSingleContainer(SingleContainer mi)
        {
            //构造要查询的sql语句
            string sql = @"update bg_cust_dec_container_singlewindow set container_md=@p4, goods_no=@p5,lcl_flag=@p6,container_wt=@p7,update_date=@p8
                         where batch = '" + mi.Batch + "' and container_id = '" + mi.ContainerId + "' and cust_dec_head_id = '" + mi.CustDecHeadId + "' ";

            //构造sql语句的参数
            MySqlParameter[] ps = //使用数组初始化器
            {
                new MySqlParameter("@p4", mi.ContainerMd),
                new MySqlParameter("@p5", mi.GoodsNo),
                new MySqlParameter("@p6", mi.LclFlag),
                new MySqlParameter("@p7", mi.ContainerWt),
                new MySqlParameter("@p8", mi.UpdateDate)
            };

            //执行语句并返回结果
            return(mysqlHelper.ExcuteNonQuery(sql, ps.ToArray()));
        }
Пример #7
0
        //查询SingleContainer是否存在
        public List <SingleContainer> GetSingleContainer(SingleContainer singleContainer)
        {
            //构造要查询的sql语句
            string sql = "select * from bg_cust_dec_container_singlewindow where batch = '" + singleContainer.Batch + "' and container_id = '" + singleContainer.ContainerId + "' and cust_dec_head_id = '" + singleContainer.CustDecHeadId + "' ";
            //使用helper进行查询,得到结果
            DataTable dt = mysqlHelper.GetDataTable(sql);
            //将dt中的数据转存到list中
            List <SingleContainer> list = new List <SingleContainer>();

            foreach (DataRow row in dt.Rows)
            {
                list.Add(new SingleContainer()
                {
                    Id = row["id"].ToString()
                });
            }
            //将集合返回
            return(list);
        }
Пример #8
0
        public override void BuildLayout(SingleContainer editorContainer, IAssetManager assetManager)
        {
            this.m_FileSelect          = new FileSelect();
            this.m_FileSelect.Changed += (sender, e) =>
            {
                using (var reader = new StreamReader(this.m_FileSelect.Path))
                {
                    this.m_Asset.Code = reader.ReadToEnd();
                }
                assetManager.Recompile(this.m_Asset);
                assetManager.Save(this.m_Asset);
            };

            var form = new Form();

            form.AddControl("Source File:", this.m_FileSelect);

            var vertContainer = new VerticalContainer();

            vertContainer.AddChild(form, "*");

            editorContainer.SetChild(vertContainer);
        }
Пример #9
0
        /// <summary>
        /// 插入集装箱信息
        /// </summary>
        /// <param name="mi">ManagerInfo类型的对象</param>
        /// <returns></returns>
        public int InsertSingleContainer(SingleContainer mi)
        {
            //构造insert语句
            string sql = @"insert into bg_cust_dec_container_singlewindow(cust_dec_head_id,container_id,container_md,goods_no,lcl_flag,container_wt,batch,create_date,update_date)";

            sql += " values(@p0,@p1,@p2,@p3,@p4,@p5,@p6,@p7,@p8)";
            //构造sql语句的参数
            MySqlParameter[] ps = //使用数组初始化器
            {
                new MySqlParameter("@p0", mi.CustDecHeadId),
                new MySqlParameter("@p1", mi.ContainerId),
                new MySqlParameter("@p2", mi.ContainerMd),
                new MySqlParameter("@p3", mi.GoodsNo),
                new MySqlParameter("@p4", mi.LclFlag),
                new MySqlParameter("@p5", mi.ContainerWt),
                new MySqlParameter("@p6", mi.Batch),

                new MySqlParameter("@p7", mi.CreateDate),
                new MySqlParameter("@p8", mi.UpdateDate)
            };
            //执行插入操作

            return(mysqlHelper.ExcuteNonQuery(sql, ps));
        }
Пример #10
0
 public override void FinishLayout(SingleContainer editorContainer, IAssetManager assetManager)
 {
 }
Пример #11
0
 //更新集装箱信息
 public bool UpdateSingleContainer(SingleContainer singleContainer)
 {
     //调用查询方法
     return(miDal.UpdateSingleContainer(singleContainer) > 0);
 }
Пример #12
0
 //查询SingleContainer是否存在
 public List <SingleContainer> GetSingleContainer(SingleContainer singleContainer)
 {
     //调用查询方法
     return(miDal.GetSingleContainer(singleContainer));
 }
Пример #13
0
 public bool InsertSingleContainer(SingleContainer mi)
 {
     //调用dal层的insert方法,完成插入操作
     return(miDal.InsertSingleContainer(mi) > 0);
 }
Пример #14
0
        public override void BuildLayout(SingleContainer editorContainer, IAssetManager assetManager)
        {
            this.m_FontNameTextBox = new TextBox {
                Text = this.m_Asset.FontName
            };
            this.m_FontNameTextBox.TextChanged += (sender, e) =>
            {
                this.m_Asset.FontName = this.m_FontNameTextBox.Text;

                this.StartCompilation(assetManager);
            };
            this.m_FontSizeTextBox = new TextBox {
                Text = this.m_Asset.FontSize.ToString()
            };
            this.m_FontSizeTextBox.TextChanged += (sender, e) =>
            {
                try
                {
                    this.m_Asset.FontSize = Convert.ToInt32(this.m_FontSizeTextBox.Text);

                    this.StartCompilation(assetManager);
                } catch (FormatException) { }
            };
            this.m_UseKerningTextBox = new TextBox {
                Text = this.m_Asset.UseKerning.ToString()
            };
            this.m_UseKerningTextBox.TextChanged += (sender, e) =>
            {
                try
                {
                    this.m_Asset.UseKerning = Convert.ToBoolean(this.m_UseKerningTextBox.Text);

                    this.StartCompilation(assetManager);
                } catch (FormatException) { }
            };
            this.m_SpacingTextBox = new TextBox {
                Text = this.m_Asset.Spacing.ToString()
            };
            this.m_SpacingTextBox.TextChanged += (sender, e) =>
            {
                try
                {
                    this.m_Asset.Spacing = Convert.ToInt32(this.m_SpacingTextBox.Text);

                    this.StartCompilation(assetManager);
                } catch (FormatException) { }
            };

            var form = new Form();

            form.AddControl("Font Name:", this.m_FontNameTextBox);
            form.AddControl("Font Size:", this.m_FontSizeTextBox);
            form.AddControl("Use Kerning (true/false):", this.m_UseKerningTextBox);
            form.AddControl("Spacing:", this.m_SpacingTextBox);

            this.m_StatusLabel      = new Label();
            this.m_StatusLabel.Text = "";

            var fontViewer = new FontViewer();

            fontViewer.Font = this.m_Asset;

            var vertContainer = new VerticalContainer();

            vertContainer.AddChild(form, "*");
            vertContainer.AddChild(this.m_StatusLabel, "20");
            vertContainer.AddChild(fontViewer, "200");

            editorContainer.SetChild(vertContainer);
        }
Пример #15
0
        public static Func <TArg, TResult> MemoizeOne <TArg, TResult>(Func <TArg, TResult> factory, IEqualityComparer <TArg> comparer = null)
        {
            var container = new SingleContainer <TArg, TResult>();

            return(MemoizeOneInternal(factory, null, comparer ?? EqualityComparer <TArg> .Default, () => container));
        }