Пример #1
0
        private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex != -1)
            {
                if (this.dataGridView2.CurrentCell.OwningColumn.Name == "删除")//q(Msg_Type.fielddelete)
                {
                    int index = dataGridView2.CurrentRow.Index;
                    BindList.RemoveAt(index);
                    for (int i = 0; i < BindList.Count; i++)
                    {
                        BindList[i].XH = (i + 1);
                    }
                    int a = dataGridView2.Columns.Count;
                    if (BindList.Count == 0)
                    {
                        dataGridView2.DataSource = new List <MES_TM_TMINFO_LIST>();
                        dataGridView2.Columns["删除"].DisplayIndex = 4;//q(Msg_Type.fielddelete)
                    }
                    else
                    {
                        dataGridView2.DataSource = BindList.ToArray();
                        dataGridView2.Columns["删除"].DisplayIndex = 4;//q(Msg_Type.fielddelete)
                    }
                    dataGridView2.ClearSelection();

                    Verify();
                }
            }
        }
 public ComplexProduction()
 {
     partnerId         = 1;
     locationId        = 1;
     operationType     = OperationType.ComplexProductionMaterial;
     additionalDetails = new BindList <ComplexProductionDetail> ();
 }
Пример #3
0
        public ComplexRecipe(ComplexProduction production)
            : this()
        {
            locationId      = production.LocationId;
            location        = production.Location;
            location2       = production.Location2;
            partnerId       = production.PartnerId;
            partnerName     = production.PartnerName;
            partnerName2    = production.PartnerName2;
            userId          = production.UserId;
            userName        = production.UserName;
            userName2       = production.UserName2;
            loggedUserId    = production.LoggedUserId;
            loggedUserName  = production.LoggedUserName;
            loggedUserName2 = production.LoggedUserName2;

            foreach (ComplexProductionDetail detail in production.DetailsMat)
            {
                detailsMat.Add(new ComplexRecipeDetail(detail));
            }

            detailsMat = GetCombinedDetails(false, true, detailsMat);

            foreach (ComplexProductionDetail detail in production.DetailsProd)
            {
                detailsProd.Add(new ComplexRecipeDetail(detail));
            }

            detailsProd = GetCombinedDetails(false, true, detailsProd);
        }
Пример #4
0
        /// <summary>
        /// 为DataGridView添加行
        /// 仅仅适用DataGridCRUDHelper类下操作
        /// </summary>
        /// <typeparam name="T">泛型</typeparam>
        /// <param name="gridView">DataGridView</param>
        /// <param name="model">是否添加成功</param>
        /// <returns>操作是否成功</returns>
        public static bool AddObject <T>(this DataGridView gridView, T model)
            where T : class
        {
            bool _result = true;

            try
            {
                BindList <T> _bindList = gridView.ToBindList <T>();

                if (_bindList == null)
                {
                    _bindList = new BindList <T>();
                    _bindList.Add(model);
                    SetDataSource <T>(gridView, _bindList);
                }
                else
                {
                    _bindList.Add(model);
                }
            }
            catch (Exception)
            {
                _result = false;
            }

            return(_result);
        }
Пример #5
0
        private void toolStripOpen_Click(object sender, EventArgs e)
        {
            openFileDialog1.Title  = "Open an XML file";
            openFileDialog1.Filter = "XML Documents|*.xml";

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    path = openFileDialog1.FileName;

                    using (FileStream fStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.None))
                    {
                        XmlSerializer          xmlSerializer = new XmlSerializer(typeof(BindingList <Employee>));
                        BindingList <Employee> employees     = (BindingList <Employee>)xmlSerializer.Deserialize(fStream);

                        persons.Clear();
                        BindList.AddRange(employees, persons);

                        comboBox1.DataSource    = persons;
                        comboBox1.DisplayMember = "FullName";
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
Пример #6
0
        /// <summary>
        ///  为DataGridView添加行
        /// </summary>
        /// <typeparam name="T">泛型</typeparam>
        /// <param name="gridView">DataGridView</param>
        /// <param name="list">集合</param>
        /// <returns>操作是否成功</returns>
        public static bool AddObject <T>(this DataGridView gridView, List <T> list)
        {
            bool _result = true;

            try
            {
                BindList <T> _bindList = gridView.ToBindList <T>();

                if (_bindList == null)
                {
                    _bindList = new BindList <T>(list);
                    SetDataSource <T>(gridView, _bindList);
                }
                else
                {
                    _bindList = gridView.ToBindList <T>();

                    foreach (T t in list)
                    {
                        _bindList.Add(t);
                    }
                }
            }
            catch (Exception)
            {
                _result = false;
            }

            return(_result);
        }
Пример #7
0
        public FilesSelectorM(Type filterType, BindList <PathWithFilters> pathsWithFilters = null)
        {
            FilterType            = filterType;
            this.PathsWithFilters = pathsWithFilters != null ? pathsWithFilters : new BindList <PathWithFilters>();

            this.pathsWithFilters.ItemNumberChanged      += PathWithFiltersPropertyChanged;
            this.pathsWithFilters.ObjectTPropertyChanged += PathWithFiltersPropertyChanged;
        }
Пример #8
0
 private static void SetDataSource <T>(DataGridView dataGrid, BindList <T> list)
 {
     dataGrid.UIThread <DataGridView>(gv =>
     {
         BindingSource _source = new BindingSource(list, null);
         gv.DataSource         = _source;
     });
 }
Пример #9
0
        /// <summary>
        /// 查找所有合法条件的数据集合
        /// </summary>
        /// <typeparam name="T">泛型</typeparam>
        /// <param name="gridView">DataGridView</param>
        /// <param name="match">Predicate为何</param>
        /// <returns>返回符合数据;没有合法的返回NULL</returns>
        public static IList <T> FindAll <T>(this DataGridView gridView, Predicate <T> match)
        {
            BindList <T> _source = gridView.ToBindList <T>();

            if (_source != null)
            {
                return(_source.FindAll(match));
            }

            return(null);
        }
Пример #10
0
 public Window(Main _controller, Model.Buffer _model)
 {
     Controller = _controller;
     Model = new Bind<Model.Buffer>(_model);
     CurrentMode = new BindList<WindowMode>();
     CurrentMode.Event.Changed += (list) => { CurrentKeyMap = list.FoldLeft(EmptyKeyMap, (a, b) => a + b.KeyMap); };
     CurrentMode.Add(Controller.WindowModes[0]);
     CurrentMode.Add(Controller.WindowModes[2]);
     CurrentMode.Add(Controller.WindowModes[3]);
     Parser = new CommandParser();
 }
Пример #11
0
        /// <summary>
        /// 将绑定的数据源转换成IList
        /// 仅仅适用DataGridCRUDToolV2Plus类下操作
        /// </summary>
        /// <typeparam name="T">泛型</typeparam>
        /// <param name="gridView">DataGridView</param>
        /// <returns>IList</returns>
        public static BindList <T> ToBindList <T>(this DataGridView gridView)
        {
            BindList <T>  _source     = null;
            BindingSource _bindSource = (BindingSource)gridView.DataSource;

            if (_bindSource != null)
            {
                _source = _bindSource.DataSource as BindList <T>;
            }

            return(_source);
        }
Пример #12
0
        /// <summary>
        /// 条件查找实体类
        /// </summary>
        /// <typeparam name="T">泛型</typeparam>
        /// <param name="gridView">DataGridView</param>
        /// <param name="match">Predicate</param>
        /// <returns>没有查到返回NULL</returns>
        public static T Find <T>(this DataGridView gridView, Predicate <T> match)
            where T : class
        {
            BindList <T> _source = gridView.ToBindList <T>();

            if (_source != null)
            {
                return(_source.Find(match));
            }

            return(null);
        }
Пример #13
0
        public void getReportInfoByTm()
        {
            bool isY = false;

            for (int i = 0; i < BindList.Count; i++)
            {
                if (SMtextBox.Text.Trim().ToUpper() == BindList[i].TM)
                {
                    isY = true;
                }
            }
            if (isY)
            {
                ShowMeg(string.Format(q(Msg_Type.msgtmcf), SMtextBox.Text.Trim()));//
                SMtextBox.Clear();
                SMtextBox.Select();
                return;
            }


            MES_WLKCBS_GETWLZJ_IN model = new MES_WLKCBS_GETWLZJ_IN();

            model.MBLNR   = ZSL_BCS303_BS.MBLNR;
            model.XCBS    = ZSL_BCS303_BS.XCBS;
            model.MJAHR   = ZSL_BCS303_BS.MJAHR;
            model.LINE_ID = ZSL_BCS303_BS.LINE_ID;
            model.LIFNR   = ZSL_BCS303_BS.LIFNR;
            model.TM      = SMtextBox.Text.Trim().ToUpper();
            SELECT_MES_TM_TMINFO_BYTM res = ServicModel.TM_TMINFO.SELECT_WLKCBS(model, getToken());

            if (res.MES_RETURN.TYPE.Equals("S"))
            {
                for (int i = 0; i < res.MES_TM_TMINFO_LIST.Length; i++)
                {
                    BindList.Add(res.MES_TM_TMINFO_LIST[i]);
                }
                for (int i = 0; i < BindList.Count; i++)
                {
                    BindList[i].XH   = i + 1;
                    BindList[i].WLMS = BindList[i].WLH + "/" + BindList[i].WLMS;
                }
                dataGridView2.DataSource = new List <MES_TM_TMINFO_LIST>();
                dataGridView2.DataSource = BindList;
                dataGridView2.ClearSelection();
                Verify();
            }
            else
            {
                ShowMeg(res.MES_RETURN.MESSAGE);
            }
            SMtextBox.Clear();
            SMtextBox.Select();
        }
Пример #14
0
        protected static void CreateChild(Hashtable boundFields, BindList <FormObject> children, XElement child)
        {
            FormObject childObj;

            switch (child.Name.LocalName.ToLowerInvariant())
            {
            case "hbox":
                childObj = DocumentHelper.FormObjectCreator.CreateHBox(child, boundFields);
                break;

            case "vbox":
                childObj = DocumentHelper.FormObjectCreator.CreateVBox(child, boundFields);
                break;

            case "textbox":
                childObj = DocumentHelper.FormObjectCreator.CreateTextBox(child, boundFields);
                break;

            case "picture":
                childObj = DocumentHelper.FormObjectCreator.CreatePicture(child, boundFields);
                break;

            case "rectangle":
                childObj = new Rectangle(child, boundFields);
                break;

            case "hline":
                childObj = DocumentHelper.FormObjectCreator.CreateHLine(child);
                break;

            case "vline":
                childObj = DocumentHelper.FormObjectCreator.CreateVLine(child);
                break;

            case "table":
                childObj = DocumentHelper.FormObjectCreator.CreateTable(child, boundFields);
                break;

            case "boxitem":
                childObj = DocumentHelper.FormObjectCreator.CreateBox(child, boundFields);
                break;

            case "barcode":
                childObj = DocumentHelper.FormObjectCreator.CreateLinearBarcode(child, boundFields);
                break;

            default:
                return;
            }

            children.Add(childObj);
        }
Пример #15
0
        /// <summary>
        /// 判断某列等于某个值是否存在
        /// </summary>
        /// <param name="gridView">DataGridView</param>
        /// <param name="columnName">列名称</param>
        /// <param name="key">列值</param>
        /// <returns>存在返回True;不存在返回FASLE</returns>
        public static bool Exist <T>(this DataGridView gridView, string columnName, Object key)
        {
            bool         _result = false;
            BindList <T> _source = gridView.ToBindList <T>();

            if (_source != null)
            {
                int _index = _source.Find(-1, columnName, key);
                _result = _index > 0;
            }

            return(_result);
        }
Пример #16
0
 public EditQuickItems(MenuItemCollection mainMenu, AccelGroup accelGroup)
 {
     this.mainMenu   = mainMenu;
     this.accelGroup = accelGroup;
     itemShortcuts   = new BindList <ItemShortcut> ();
     changedMenus    = new List <string> ();
     AccelMap.Foreach(IntPtr.Zero, AddItemShortcut);
     if (itemShortcuts.Count == 0)
     {
         itemShortcuts.Add(new ItemShortcut());
     }
     Initialize();
 }
Пример #17
0
        protected override void btnNew_Clicked(object o, EventArgs args)
        {
            Partner partner = null;

            if (BusinessDomain.LoggedUser.LockedPartnerId > 0)
            {
                partner = Partner.GetById(BusinessDomain.LoggedUser.LockedPartnerId);
            }
            else
            {
                using (ChooseEditPartner dialog = new ChooseEditPartner(true, string.Empty))
                    if (dialog.Run() == ResponseType.Ok && dialog.SelectedItems.Length > 0)
                    {
                        partner = dialog.SelectedItems [0];
                    }
            }

            if (partner == null)
            {
                return;
            }

            using (EditNewAdvancePayment dialog = new EditNewAdvancePayment(partner)) {
                if (dialog.Run() != ResponseType.Ok || dialog.Payments.Count <= 0)
                {
                    return;
                }

                BindList <Payment> advances      = dialog.Payments;
                List <Payment>     savedPayments = Payment.DistributeAdvances(advances, partner.Id);
                for (int i = advances.Count - 1; i >= 0; i--)
                {
                    if (advances [i].Sign < 0)
                    {
                        advances.RemoveAt(i);
                    }
                    else
                    {
                        advances [i].CommitAdvance();
                    }
                }

                savedPayments.AddRange(advances);
                if (savedPayments.Count > 0)
                {
                    dialog.PrintPayments(savedPayments);
                }

                ReinitializeGrid(true, null);
            }
        }
Пример #18
0
        public void LoadBinds(string json)
        {
            if (mActionNames == null || mActionNames.Length == 0)
            {
                Debug.LogWarning("No action config loaded.  There will be no bindings!");
                return;
            }

            List <Bind> keys = BindList.FromJSON(json);

            if (mBinds == null || mBinds.Length == 0)
            {
                Dictionary <int, BindData> binds = new Dictionary <int, BindData>();

                foreach (Bind key in keys)
                {
                    if (key != null && key.keys != null)
                    {
                        binds.Add(key.action, new BindData(key));
                    }
                }

                //set bindings
                mBinds = new BindData[actionCount];
                foreach (KeyValuePair <int, BindData> pair in binds)
                {
                    mBinds[pair.Key] = pair.Value;
                }

                //register input actions to localizer
                for (int i = 0; i < actionCount; i++)
                {
                    Localize.instance.RegisterParam("input_" + i, OnTextParam);
                }
            }
            else
            {
                foreach (Bind key in keys)
                {
                    if (key != null && key.keys != null)
                    {
                        if (mBinds[key.action] != null)
                        {
                            BindData bindDat = mBinds[key.action];
                            bindDat.ApplyKeys(key);
                        }
                    }
                }
            }
        }
Пример #19
0
        public ChooseItemsForPromotion(IEnumerable promotions)
        {
            selectedDetails = new BindList <SaleDetail> ();
            if (promotions != null)
            {
                foreach (SaleDetail promotion in promotions)
                {
                    selectedDetails.Add(promotion);
                }
            }
            else
            {
                selectedDetails.Add(new SaleDetail());
            }

            Initialize();
        }
Пример #20
0
        protected override void LotsEvaluate(BindList <StockTakingDetail> detailsList, StockTakingDetail detail, bool forceChoice = false)
        {
            if (!BusinessDomain.AppConfiguration.ItemsManagementUseLots)
            {
                return;
            }

            if (detail.ItemId < 0)
            {
                return;
            }

            if (detail.LotId > 0)
            {
                return;
            }

            operation.LotsEvaluate(detailsList, detail, codeLot, barcodeUsed);
        }
Пример #21
0
 public virtual void Clear()
 {
     try
     {
         if (this.QueryControl != null)
         {
             foreach (Sys_Bind sys_Bind in BindList.Where(b => b.Bind_Type == 0).OrderBy(b => b.Bind_Sort))
             {
                 Control[] Controls = this.QueryControl.Controls.Find(sys_Bind.Bind_Field, true);
                 if (Controls.Length > 0)
                 {
                     BaseEdit baseEdit = (BaseEdit)Controls[0];
                     baseEdit.Text      = string.Empty;
                     baseEdit.EditValue = sys_Bind.Bind_Default;
                     if (baseEdit.GetType().Equals(typeof(CheckEdit)))
                     {
                         CheckEdit chkEdit = (CheckEdit)baseEdit;
                         chkEdit.Text    = string.Empty;
                         chkEdit.Checked = sys_Bind.Bind_Default.ToBoolEx();
                     }
                     //RefreshEditValue
                     if (baseEdit.GetType().Equals(typeof(CheckedComboBoxEdit)))
                     {
                         CheckedComboBoxEdit chkComboBox = (CheckedComboBoxEdit)baseEdit;
                         chkComboBox.RefreshEditValue();
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     //if (this.QueryControl != null)
     //{
     //    InitializeQuery();
     //    //ClearControl(this.QueryControl);
     //}
     finally
     {
     }
 }
Пример #22
0
        /// <summary>
        /// 移出数据项
        /// </summary>
        /// <typeparam name="T">泛型</typeparam>
        /// <param name="gridView">gridView</param>
        /// <param name="t">实体类</param>
        /// <returns>移出是否成功</returns>
        public static bool RemoveObject <T>(this DataGridView gridView, T t)
        {
            bool _result = false;

            try
            {
                BindList <T> _bindList = gridView.ToBindList <T>();

                if (_bindList != null)
                {
                    _result = _bindList.Remove(t);
                }
            }
            catch (Exception)
            {
                _result = false;
            }

            return(_result);
        }
Пример #23
0
        /// <summary>
        /// 移出数据项
        /// </summary>
        /// <typeparam name="T">泛型</typeparam>
        /// <param name="gridView">gridView</param>
        /// <param name="match">条件委托</param>
        /// <returns>移出行数</returns>
        public static int RemoveObject <T>(this DataGridView gridView, Predicate <T> match)
        {
            int _result = 0;

            try
            {
                BindList <T> _bindList = gridView.ToBindList <T>();

                if (_bindList != null)
                {
                    _result = _bindList.Remove(match);
                }
            }
            catch (Exception)
            {
                _result = 0;
            }

            return(_result);
        }
Пример #24
0
        /// <summary>
        /// 根据字段名称以及值查找对应的实体类
        /// </summary>
        /// <typeparam name="T">泛型</typeparam>
        /// <param name="gridView">DataGridView</param>
        /// <param name="columnName">列名称</param>
        /// <param name="key">列值</param>
        /// <returns>没有查到返回NULL</returns>
        public static T Find <T>(this DataGridView gridView, string columnName, object key)
            where T : class
        {
            if (!string.IsNullOrEmpty(columnName))
            {
                BindList <T> _source = gridView.ToBindList <T>();

                if (_source != null)
                {
                    int _index = _source.Find(-1, columnName, key);

                    if (_index != -1)
                    {
                        return(_source[_index]);
                    }
                }
            }

            return(null);
        }
Пример #25
0
        public PaymentWidget(BindList <Payment> payments, PriceType priceType)
        {
            XML form = FormHelper.LoadGladeXML("Widgets.PaymentWidget.glade", "hboxMain");

            form.Autoconnect(this);

            this.payments  = payments;
            this.priceType = priceType;
            btnChooseMoney.SetChildImage(FormHelper.LoadImage("Icons.Banknote16.png"));

            lblPayments.SetText(Translator.GetString("Payments"));

            cboPaymentMethod.FocusInEvent += cboPaymentMethod_FocusInEvent;
            txtReceived.Changed           += OnValueChanged;
            txtReceived.FocusInEvent      += cboPaymentMethod_FocusInEvent;
            scwPayments.VScrollbar.Shown  += VScrollbar_Shown;
            scwPayments.VScrollbar.Hidden += VScrollbar_Hidden;
            btnChooseMoney.Toggled        += btnChooseMoney_Toggled;
            btnChooseMoney.Active          = BusinessDomain.AppConfiguration.LastChooseMoneyVisible;

            txtReceived.GrabFocus();
        }
Пример #26
0
        public void RecalculatePrices()
        {
            BindList <ComplexRecipeDetail> products = detailsProd;

            double totalMat  = detailsMat.Sum(t => t.Total);
            double totalProd = products.Sum(t => t.Quantity * t.PriceOut);

            bool allPriceOutAreZero = false;

            if (totalProd.IsZero() && products.Count > 0)
            {
                allPriceOutAreZero = products.All(t => t.PriceOut <= 0);
                if (allPriceOutAreZero)
                {
                    totalProd += products.Sum(t => t.Quantity);
                }
            }

            foreach (ComplexRecipeDetail detail in products.Where(p => p.Quantity != 0))
            {
                detail.OriginalPriceInEvaluate(totalProd.IsZero() ? 0 : (allPriceOutAreZero ? 1 : detail.PriceOut) * totalMat / totalProd);
                detail.TotalEvaluate();
            }
        }
Пример #27
0
        public Main(Directory _dir)
        {
            Files = new StrongEqCache<File,Meta.File>(f => new Meta.File(this, f));
            Directories = new StrongEqCache<Directory, Meta.Directory>(d => new Meta.Directory(this, d));

            Config = LoadConfig();
            while (!DirIsProjectRoot(_dir))
            {
                _dir = _dir.Parent;
                if (_dir == null)
                {
                    // TODO
                    // Create an exception class to throw here.
                    // It'll get caught somewhere and result in a special interaction with the user
                    // to determine which directory to create the project file in.
                    throw new InvalidOperationException();
                }
            }
            RootInfo = _dir;
            Ini.IniParser.Parse(System.IO.Path.Combine(RootInfo.FullName, ProjectMetaFileName), ref meta);
            Matcher = new Karl.Fs.Matcher();
            if (meta.ContainsKey("include"))
            {
                foreach (var i in meta["include"].Keys)
                {
                    Matcher.IncludeGlob(i);
                }
            }
            if (meta.ContainsKey("exclude"))
            {
                foreach (var e in meta["exclude"].Keys)
                {
                    Matcher.ExcludeGlob(e);
                }
            }
            IList<Karl.Fs.File> fileInfos;
            IList<Karl.Fs.Directory> dirInfos;
            Matcher.MatchAll(RootInfo, out fileInfos, out dirInfos);
            Meta.File.MatchCheckEnabled = false;
            Meta.Directory.MatchCheckEnabled = false;
            fileInfos.Select(f => Files.Get(f)).ToList();
            dirInfos.Select(d => Directories.Get(d)).ToList();
            Root = Directories.Get(RootInfo);
            Meta.File.MatchCheckEnabled = true;
            Meta.Directory.MatchCheckEnabled = true;

            Buffers = new BindList<Buffer>();
        }
Пример #28
0
 public StockTakingProtocol()
 {
     ProtocolSubTitle           = Translator.GetString("for items stock-taking");
     StockTakingProtocolDetails = new BindList <StockTakingProtocolDetail> ();
 }
Пример #29
0
 public TransferReceipt()
 {
     ReceiptDetails = new BindList <ReceiptDetail> ();
 }
Пример #30
0
 public ProductionProtocol()
 {
     ProtocolDetailsProducts  = new BindList <ProtocolDetail> ();
     ProtocolDetailsMaterials = new BindList <ProtocolDetail> ();
 }
Пример #31
0
Файл: Main.cs Проект: cpdean/di
        public Main(DirectoryInfo _dir)
        {
            while (!DirIsProjectRoot(_dir))
            {
                _dir = _dir.Parent;
                if (_dir == null)
                {
                    // TODO
                    // Create an exception class to throw here.
                    // It'll get caught somewhere and result in a special interaction with the user
                    // to determine which directory to create the project file in.
                    throw new InvalidOperationException();
                }
            }
            Root = _dir;
            Ini.IniParser.Parse(Path.Combine(Root.FullName, ConfigFileName), ref config);
            var m = new FileMatcher();
            m.ExcludeExecutableFiles = config[""].GetBoolWithDefault("exclude-exec", true);
            if (config.ContainsKey("include"))
            {
                foreach (var i in config["include"].Keys)
                {
                    m.IncludeGlob(i);
                }
            }
            if (config.ContainsKey("exclude"))
            {
                foreach (var e in config["exclude"].Keys)
                {
                    m.ExcludeGlob(e);
                }
            }
            files = m.MatchAll(Root).Select(f => new File(this, f)).ToList();
            Files = new ReadOnlyCollection<File>(files);

            buffers = new BindList<Buffer>();
            buffers.Add(new Buffer());
            Buffers = new ReadOnlyCollection<Buffer>(buffers);
        }
Пример #32
0
 public Protocol()
 {
     ProtocolDetails = new BindList <ProtocolDetail> ();
 }
Пример #33
0
 protected Receipt()
 {
     ReceiptDetails = new BindList <ReceiptDetail> ();
 }
Пример #34
0
    // attempts to set the specified drop down to the value specified. If a delegate is supplied
    // and the attempt was successful, the delegate will be run and the result will be indicated
    private bool SetDropDown(ListControl list, string value, BindList bindListDelegate)
    {
        ListItem item = list.Items.FindByValue(value);
        if (item != null)
        {
            item.Selected = true;

            if (bindListDelegate != null)
                bindListDelegate();

            return true;
        }
        return false;
    }
Пример #35
0
Файл: Main.cs Проект: cpdean/di
        public Main(Model.Main m)
        {
            Model = m;

            var windowModes = new List<WindowMode>();
            WindowModes = new ReadOnlyCollection<WindowMode>(windowModes);

            // Command mode bindings (0)
            var commandMode = new KeyMap() { Priority = 5 };
            commandMode.Add(Key.i, new Command.ClearWindowMode(), new Command.AddWindowMode(1));
            commandMode.Add(Key.h, new Command.Down());
            commandMode.Add(Key.t, new Command.Up());
            commandMode.Add(Key.d, new Command.Left());
            commandMode.Add(Key.n, new Command.Right());
            commandMode.Add(Key.Down, new Command.Down());
            commandMode.Add(Key.Up, new Command.Up());
            commandMode.Add(Key.Left, new Command.Left());
            commandMode.Add(Key.Right, new Command.Right());
            commandMode.Add(Key.o, new Command.OpenFile());
            commandMode.Add(Key.w, new Command.ClearWindowMode(), new Command.AddWindowMode(4), new Command.AddWindowMode(3));
            windowModes.Add(new WindowMode { Name = "Command", KeyMap = commandMode });

            // Insert mode bindings (1)
            var insertMode = new KeyMap();
            insertMode.SetDefault(new Command.InsertKey());
            insertMode.Add(Key.Return, new Command.InsertChar('\n'));
            insertMode.Add(Key.Escape,
                           new Command.DiscardInput(),
                           new Command.ClearWindowMode(),
                           new Command.AddWindowMode(0),
                           new Command.AddWindowMode(2),
                           new Command.AddWindowMode(3));
            insertMode.Add(Key.BackSpace, new Command.Delete(), new Command.Backspace());
            insertMode.Add(Key.Tab, new Command.Tab());
            insertMode.Add(Key.Down, new Command.Down());
            insertMode.Add(Key.Up, new Command.Up());
            insertMode.Add(Key.Left, new Command.Left());
            insertMode.Add(Key.Right, new Command.Right());
            insertMode.Add(Key.Delete, new Command.Delete(), new Command.Right());
            windowModes.Add(new WindowMode { Name = "Insert", KeyMap = insertMode });

            // Number mode bindings (2)
            var numberMode = new KeyMap();
            numberMode.Add(Key.Key_0, new NumCommand());
            numberMode.Add(Key.Key_1, new NumCommand());
            numberMode.Add(Key.Key_2, new NumCommand());
            numberMode.Add(Key.Key_3, new NumCommand());
            numberMode.Add(Key.Key_4, new NumCommand());
            numberMode.Add(Key.Key_5, new NumCommand());
            numberMode.Add(Key.Key_6, new NumCommand());
            numberMode.Add(Key.Key_7, new NumCommand());
            numberMode.Add(Key.Key_8, new NumCommand());
            numberMode.Add(Key.Key_9, new NumCommand());
            windowModes.Add(new WindowMode { Name = "Number", Hidden = true, KeyMap = numberMode });

            // Common bindings (3)
            var commonMode = new KeyMap();
            commonMode.Add(Key.Escape, new Command.DiscardInput());
            windowModes.Add(new WindowMode { Name = "Common", Hidden = true, KeyMap = commonMode });

            // Window mode bindings (4)
            var windowMode = new KeyMap();
            windowMode.Add(Key.a,
                           new Command.OpenFileInNewWindow(),
                           new Command.ClearWindowMode(),
                           new Command.AddWindowMode(0),
                           new Command.AddWindowMode(2),
                           new Command.AddWindowMode(3));
            windowMode.Add(Key.c,
                           new Command.CloseWindow(),
                           new Command.ClearWindowMode(),
                           new Command.AddWindowMode(0),
                           new Command.AddWindowMode(2),
                           new Command.AddWindowMode(3));
            windowModes.Add(new WindowMode { Name = "Window", KeyMap = windowMode });

            Windows = new BindList<Window>();
            if (Model.Buffers.HasAny())
            {
                var window = new Window(this, Model.Buffers.Item(0));
                Windows.Add(window);
                FocusedWindow.Value = window;
            }
            WindowsEvents = Windows.Event;
        }