Пример #1
0
 private void frmKetCau_Load(object sender, EventArgs e)
 {
     BindingData.BindingKetCau(treeViewKetCau);
     BindingData.BindingNhomKetCau(cboNhomKetCau);
     BindingData.BindingKetCau(cboKetCau, -1);
     ResetFormKC();
 }
        /// <summary>
        /// Initializes a new instance of the AzureNettcpRequestSender class.
        /// </summary>
        /// <param name="epr">endpoint address of the target proxy or host</param>
        /// <param name="binding">backend binding</param>
        /// <param name="serviceOperationTimeout">service operation timeout of backend connection</param>
        /// <param name="proxyClientPool">connection pool</param>
        /// <param name="backendBindingData">binding data of the connection between proxy and host</param>
        /// <param name="dispatcher">dispatcher instance</param>
        public AzureNettcpRequestSender(EndpointAddress epr, Binding binding, int serviceOperationTimeout, ProxyClientPool proxyClientPool, BindingData backendBindingData, IDispatcher dispatcher)
            : base(epr, binding, serviceOperationTimeout, dispatcher)
        {
            this.proxyClientPool = proxyClientPool;

            this.backendBindingData = backendBindingData;
        }
Пример #3
0
        /// <summary>
        /// Handles the SaveClick event of the mdEditBinding control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void mdEditBinding_SaveClick(object sender, EventArgs e)
        {
            BindingData binding;

            //
            // Edit existing binding or create a new one.
            //
            if (!string.IsNullOrWhiteSpace(hfEditBindingIndex.Value))
            {
                binding = BindingsState[hfEditBindingIndex.ValueAsInt()];
            }
            else
            {
                binding = new BindingData();
                BindingsState.Add(binding);
            }

            //
            // Set all the binding information.
            //
            binding.Site      = ddlEditBindingSite.SelectedValue;
            binding.IPAddress = ddlEditBindingIPAddress.SelectedValue;
            binding.Port      = nbEditBindingPort.Text.AsInteger();
            binding.Domain    = tbEditBindingDomain.Text;

            mdEditBinding.Hide();
            GridBind();
        }
        /// <include file='doc\AdvancedPropertyDialog.uex' path='docs/doc[@for="AdvancedPropertyDialog.OnNewPropertySelected"]/*' />
        /// <devdoc>
        /// Called when the user selects a new property in the listbox.
        /// </devdoc>
        private void OnNewPropertySelected(object sender, EventArgs e)
        {
            int index = propertiesList.SelectedIndex;

            if (index == -1)
            {
                keyCombo.Items.Clear();
                keyCombo.Text    = "";
                keyCombo.Enabled = false;
                return;
            }

            keyCombo.Items.Clear();
            BindingData bindingData = (BindingData)propertiesList.SelectedItem;

            ManagedPropertiesService mpService = (ManagedPropertiesService)host.GetService(typeof(ManagedPropertiesService));

            if (mpService != null)
            {
                keyCombo.Items.Clear();
                keyCombo.Items.AddRange(mpService.GetKeysForType(bindingData.Value.Property.PropertyType));
            }

            keyCombo.Text    = bindingData.Key;
            keyCombo.Enabled = bindingData.Bound;
        }
 public BindingData(BindingData bindingData)
 {
     gameObject  = bindingData.gameObject;
     isPlayer    = bindingData.isPlayer;
     constantID  = bindingData.constantID;
     parameterID = bindingData.parameterID;
 }
Пример #6
0
        /// <summary>
        /// Adds or replaces a text dictionary binding to a control's property.
        /// </summary>
        /// <param name="control">Control to add the binding to.</param>
        /// <param name="propertyName">Name of the control's property to bind to the dictionary.</param>
        /// <param name="key">Text key to use for the binding.</param>
        public static void AddBinding(Control control, string propertyName, string key)
        {
            lock (controlBindings)
            {
                Dictionary <string, BindingData> propertyBindings;
                if (!controlBindings.TryGetValue(control, out propertyBindings))
                {
                    // This is the first bound property for the control
                    propertyBindings = new Dictionary <string, BindingData>();
                    controlBindings.Add(control, propertyBindings);

                    // Be notified when the control is disposed
                    control.Disposed += Control_Disposed;
                }

                BindingData bindingData;
                if (propertyBindings.TryGetValue(propertyName, out bindingData))
                {
                    // This property of the control is already bound, remove that first
                    // Remove the binding from the control
                    control.DataBindings.Remove(bindingData.Binding);

                    // Dispose of the Tx binding instance
                    bindingData.TxDictionaryBinding.Dispose();
                }

                // Add the new binding to the control and keep track of it
                TxDictionaryBinding db = new TxDictionaryBinding(key);
                bindingData = new BindingData(
                    db,
                    control.DataBindings.Add(propertyName, db, "Text"));
                propertyBindings[propertyName] = bindingData;
            }
        }
 private void frmCongTrinh_Load(object sender, EventArgs e)
 {
     BindingCongTrinh(string.Empty, -1, -1, dtTuNgay.Value, dtDenNgay.Value);
     BindingData.BindingKhachHang(cboKhachHang);
     BindingData.BindingKhachHang(cboKhachHang1);
     BindingData.BindingTTHopDong(cboTinhTrang);
     BindingData.BindingTTHopDong(cboTinhTrang1);
 }
 private void OnKeyLostFocus(object sender, EventArgs e)
 {
     if (propertiesList.SelectedItem != null)
     {
         BindingData bindingData = (BindingData)propertiesList.SelectedItem;
         bindingData.Key = keyCombo.Text;
     }
 }
        private void OnPropertyCheck(object sender, ItemCheckEventArgs e)
        {
            bool        isChecked   = (e.NewValue != CheckState.Unchecked);
            BindingData bindingData = (BindingData)propertiesList.Items[e.Index];

            keyCombo.Text    = bindingData.Key;
            keyCombo.Enabled = bindingData.Bound = isChecked;
        }
Пример #10
0
 /// <summary>
 /// Helper method to convert a <see cref="BindingInfo"/> instance
 /// to a <see cref="BindingData"/> instance.
 /// </summary>
 /// <param name="data">The data instance.</param>
 /// <returns>The converted data.</returns>
 public static BindingInfo ToBindingInfo(this BindingData data)
 {
     return(new BindingInfo()
     {
         Uuid = data?.Uuid,
         Link = data?.Link,
         Name = data?.Name
     });
 }
Пример #11
0
        private void frmCongTrinh_Load(object sender, EventArgs e)
        {
            //BindingCongTrinh(string.Empty, -1, -1, dtTuNgay.Value, dtDenNgay.Value);
            BindingData.BindingKhachHang(cboKhachHang);
            BindingData.BindingKhachHang(cboKhachHang1);
            BindingData.BindingTTHopDong(cboTinhTrang);
            BindingData.BindingTTHopDong(cboTinhTrang1);

            SearchByCongTrinh(txtKeySearch.Text, dtTuNgay.Value, dtDenNgay.Value, Convert.ToInt32(cboKhachHang.SelectedValue), Convert.ToString(cboTinhTrang.SelectedValue));
            InitDataSetHangMuc(-1);
        }
Пример #12
0
        public AzureHttpsRequestSender(EndpointAddress epr, Binding binding, int serviceOperationTimeout, BindingData backendBindingData, IAzureQueueManager azureQueueManager, string azureServiceName, string responseStorageName, IDispatcher dispatcher)
            : base(epr, binding, serviceOperationTimeout, dispatcher)
        {
            this.backendBindingData = backendBindingData;

            this.azureQueueManager = azureQueueManager;

            this.azureServiceName = azureServiceName;

            this.responseStorageName = responseStorageName;
        }
Пример #13
0
        /// <summary>
        /// Runs the application in Console mode.
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        static async Task RunConsole(string[] args)
        {
            var builder = new ContainerBuilder();

            builder.RegisterAllAssemblyModules();

            var binding = new BindingData("http", "*:4521:");
            await AppHostUtil.BuildHost(new[] { binding }, "/").RunAsync();

#if DEBUG
            Console.ReadLine();
#endif
        }
Пример #14
0
 Task NavBar_SelectedEvent(BindingData bindingData)
 {
     return(Task.Run(() =>
     {
         UserBehaviorManager.Instance.Log(UserAction.CatEnter, bindingData.CategoryId.ToString());
         _viewModel.ItemViewModels.Clear();
         _catIdFromQS = bindingData.CategoryId;
         _lastItemId = null;
         _feedManager.SetLastId <string>(null);
         _pageNumber = 0;
         //await Binding(true);
     }));
 }
Пример #15
0
        protected void ShowBindingsUI(TimelineAsset timelineAsset, List <ActionParameter> parameters)
        {
            if (timelineAsset == null)
            {
                return;
            }

            if (newBindings == null || timelineAsset.outputTrackCount != newBindings.Length)
            {
                BindingData[] tempBindings = new BindingData[newBindings.Length];
                for (int i = 0; i < newBindings.Length; i++)
                {
                    tempBindings[i] = new BindingData(newBindings[i]);
                }

                newBindings = new BindingData[timelineAsset.outputTrackCount];
                for (int i = 0; i < newBindings.Length; i++)
                {
                    if (i < tempBindings.Length)
                    {
                        newBindings[i] = new BindingData(tempBindings[i]);
                    }
                    else
                    {
                        newBindings[i] = new BindingData();
                    }
                }
            }

            string[] popUpLabels = new string[newBindings.Length];
            for (int i = 0; i < newBindings.Length; i++)
            {
                string trackName = (timelineAsset.GetOutputTrack(i) != null) ? timelineAsset.GetOutputTrack(i).name : " Track";
                if (string.IsNullOrEmpty(trackName))
                {
                    trackName = " Unnamed";
                }
                popUpLabels[i] = "#" + i.ToString() + ": " + trackName;
            }

            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            rebindTrackIndex = EditorGUILayout.Popup("Select a track:", rebindTrackIndex, popUpLabels);
            ShowBindingUI(rebindTrackIndex, parameters);

            if (newBindings.Length > 1)
            {
                EditorGUILayout.HelpBox("All bindings will be affected - not just the one selected above.", MessageType.Info);
            }
            CustomGUILayout.EndVertical();
        }
 /// <include file='doc\AdvancedPropertyDialog.uex' path='docs/doc[@for="AdvancedPropertyDialog.SelectAllProperties"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public void SelectAllProperties()
 {
     for (int index = 0; index < propertiesList.Items.Count; ++index)
     {
         propertiesList.SelectedIndex = index;
         Application.DoEvents();
         propertiesList.SetItemChecked(index, true);
         BindingData bindingData = (BindingData)propertiesList.Items[index];
         keyCombo.Text     = bindingData.Key;
         bindingData.Bound = true;
         keyCombo.Enabled  = true;
         Application.DoEvents();
     }
 }
Пример #17
0
    // Use this for initialization
    void Awake()
    {
        m_bindingData = new BindingData[4];

        for (int i = 0; i < m_bindingData.Length; ++i)
        {
            m_bindingData[i] = new BindingData();
        }

        m_currentData    = m_bindingData[0];
        m_eCurrentPlayer = PlayerIndex.One;

        ResetBindings(false);
        m_bChangesMade = false;
    }
        /// <summary>Returns a cached <see cref="BindingData"/> representing the specified `gameObject`.</summary>
        /// <remarks>Note that the cache is cleared by <see cref="EditorApplication.hierarchyChanged"/>.</remarks>
        public static BindingData GetBindings(GameObject gameObject)
        {
            if (AnimancerEditorUtilities.InitialiseCleanDictionary(ref _ObjectToBindings))
            {
                EditorApplication.hierarchyChanged += _ObjectToBindings.Clear;
            }

            if (!_ObjectToBindings.TryGetValue(gameObject, out var bindings))
            {
                bindings = new BindingData(gameObject);
                _ObjectToBindings.Add(gameObject, bindings);
            }

            return(bindings);
        }
Пример #19
0
        /// <summary>
        /// Initializes a new instance of the AzureDispatcher class
        /// </summary>
        /// <param name="info">indicating the dispatcher info</param>
        /// <param name="binding">binding information</param>
        /// <param name="sharedData">indicating the shared data</param>
        /// <param name="observer">indicating the observer</param>
        /// <param name="queueFactory">indicating the queue factory</param>
        /// <param name="dispatcherIdle">set when the dispatcher enters idle status</param>
        public AzureDispatcher(DispatcherInfo info, Binding binding, SharedData sharedData, BrokerObserver observer, BrokerQueueFactory queueFactory, SchedulerAdapterClientFactory schedulerAdapterClientFactory, AutoResetEvent dispatcherIdle)
            : base(info, ProxyBinding.BrokerProxyBinding, sharedData, observer, queueFactory, schedulerAdapterClientFactory, dispatcherIdle)
        {
            // Initialize proxy client pool
            this.proxyClientPool = this.AttachProxyClientPool(this.Epr, sharedData.Config.LoadBalancing.MaxConnectionCountPerAzureProxy);

            // Update backend binding's maxMessageSize settings with global maxMessageSize if its enabled (> 0)
            int maxMessageSize = sharedData.ServiceConfig.MaxMessageSize;

            if (maxMessageSize > 0)
            {
                BindingHelper.ApplyMaxMessageSize(binding, maxMessageSize);
            }

            this.backendBindingData = new BindingData(binding);
        }
Пример #20
0
        private void DataBinding()
        {
            m_MyData         = new BindingData();
            m_sec            = new BindingData();
            m_MyData.TextMsg = "處理進度中...";
            Binding BindingTxtBlk = new Binding()
            {
                Source = m_MyData, Path = new PropertyPath("TextMsg")
            };
            Binding BindingTxtBlk1 = new Binding()
            {
                Source = m_sec, Path = new PropertyPath("TextMsg")
            };

            message.SetBinding(TextBlock.TextProperty, BindingTxtBlk);
            second.SetBinding(TextBlock.TextProperty, BindingTxtBlk1);
        }
Пример #21
0
        private void ShowBindingsUI(TimelineAsset timelineAsset, List <ActionParameter> parameters)
        {
            if (timelineAsset == null)
            {
                return;
            }

            if (newBindings == null || timelineAsset.outputTrackCount != newBindings.Length)
            {
                BindingData[] tempBindings = new BindingData[newBindings.Length];
                for (int i = 0; i < newBindings.Length; i++)
                {
                    tempBindings[i] = new BindingData(newBindings[i]);
                }

                newBindings = new BindingData[timelineAsset.outputTrackCount];
                for (int i = 0; i < newBindings.Length; i++)
                {
                    if (i < tempBindings.Length)
                    {
                        newBindings[i] = new BindingData(tempBindings[i]);
                    }
                    else
                    {
                        newBindings[i] = new BindingData();
                    }
                }
            }

            for (int i = 0; i < newBindings.Length; i++)
            {
                newBindings[i].parameterID = Action.ChooseParameterGUI("Track #" + i + ":", parameters, newBindings[i].parameterID, ParameterType.GameObject);
                if (newBindings[i].parameterID >= 0)
                {
                    newBindings[i].constantID = 0;
                    newBindings[i].gameObject = null;
                }
                else
                {
                    newBindings[i].gameObject = (GameObject)EditorGUILayout.ObjectField("Track #" + i + ":", newBindings[i].gameObject, typeof(GameObject), true);

                    newBindings[i].constantID = FieldToID(newBindings[i].gameObject, newBindings[i].constantID);
                    newBindings[i].gameObject = IDToField(newBindings[i].gameObject, newBindings[i].constantID, false);
                }
            }
        }
Пример #22
0
        public long?Bind(long QQ, long uid, string source)
        {
            long?previous;

            lock (BindData)
            {
                try
                {
                    previous     = BindData[QQ].Uid;
                    BindData[QQ] = new BindingData(uid, source);
                }
                catch (KeyNotFoundException)
                {
                    previous = null;
                    BindData.Add(QQ, new BindingData(uid, source));
                }
            }
            CommitBind();
            return(previous);
        }
Пример #23
0
        /// <summary>Returns a cached <see cref="BindingData"/> representing the specified `gameObject`.</summary>
        /// <remarks>Note that the cache is cleared by <see cref="EditorApplication.hierarchyChanged"/>.</remarks>
        public static BindingData GetBindings(GameObject gameObject, bool forceGather = true)
        {
            if (AnimancerEditorUtilities.InitializeCleanDictionary(ref _ObjectToBindings))
            {
                EditorApplication.hierarchyChanged += _ObjectToBindings.Clear;
            }

            if (!_ObjectToBindings.TryGetValue(gameObject, out var bindings))
            {
                if (!forceGather && !CanGatherBindings())
                {
                    return(null);
                }

                bindings = new BindingData(gameObject);
                _ObjectToBindings.Add(gameObject, bindings);
            }

            return(bindings);
        }
Пример #24
0
        Task NavBar_Selected(BindingData bindingData)
        {
            return(Task.Run(() =>
            {
                if (_publisherIdFromQS.Equals(bindingData.PublisherId))
                {
                    UserBehaviorManager.Instance.Log(UserAction.FeedEnter, bindingData.FeedId.ToString());
                }
                else
                {
                    UserBehaviorManager.Instance.Log(UserAction.PubEnter, bindingData.PublisherId.ToString());
                    UserBehaviorManager.Instance.Log(UserAction.FeedEnter, bindingData.FeedId.ToString());
                }

                _viewModel.PagedItemViewModels.Clear();
                _publisherIdFromQS = bindingData.PublisherId;
                _feedIdFromQS = bindingData.FeedId;
                _lastItemId = null;
                _feedManager.SetLastId <string>(null);
                _pageNumber = 0;
                //await Binding(true);
            }));
        }
Пример #25
0
        public static bool SetValue(BindingData data, Control control = null)
        {
            var number  = 0.0;
            var element = control ?? Keyboard.FocusedElement;

            if (element is Slider slider)
            {
                number = slider.Value;
            }
            else if (element is TextBox textBox)
            {
                if (
                    textBox.Text == "" ||
                    textBox.Text.EndsWith("-") ||
                    textBox.Text.EndsWith(".")
                    )
                {
                    return(false);
                }
                number = Strings.FormatNumberInput(textBox.Text);
            }

            var property = data.Property;

            number = ApplyNumberFormatting(number, property);

            if (data.Value is Vector vector && data.Field is FieldInfo field)
            {
                if (field.Name == "x")
                {
                    vector.x = Convert.ToInt32(number);
                }
                if (field.Name == "y")
                {
                    vector.y = Convert.ToInt32(number);
                }
            }
Пример #26
0
        private void ShowToast(ITracer tracer, NamedPipeMessages.Notification.Request request)
        {
            ToastData toastData = new ToastData();

            toastData.Visual = new VisualData();

            BindingData binding = new BindingData();

            toastData.Visual.Binding = binding;

            binding.Template = "ToastGeneric";
            binding.Items    = new XmlList <BindingItem>();
            binding.Items.Add(new BindingItem.TextData(request.Title));
            binding.Items.AddRange(request.Message.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).Select(t => new BindingItem.TextData(t)));

            XmlDocument toastXml = new XmlDocument();

            using (StringWriter stringWriter = new StringWriter())
                using (XmlWriter xmlWriter = XmlWriter.Create(stringWriter, new XmlWriterSettings {
                    OmitXmlDeclaration = true
                }))
                {
                    XmlSerializer           serializer = new XmlSerializer(toastData.GetType());
                    XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces();
                    namespaces.Add(string.Empty, string.Empty);

                    serializer.Serialize(xmlWriter, toastData, namespaces);

                    toastXml.LoadXml(stringWriter.ToString());
                }

            ToastNotification toastNotification = new ToastNotification(toastXml);

            ToastNotifier toastNotifier = ToastNotificationManager.CreateToastNotifier(ServiceAppId);

            toastNotifier.Show(toastNotification);
        }
Пример #27
0
        /// <summary>
        /// Show the specified binding for editing.
        /// </summary>
        /// <param name="binding">The binding data to be edited or null to add a new binding.</param>
        protected void ShowBinding(BindingData binding)
        {
            ddlEditBindingSite.Items.Clear();
            ddlEditBindingSite.Items.Add(new ListItem());
            try
            {
                AcmeHelper.GetSites().ToList().ForEach(s => ddlEditBindingSite.Items.Add(s));
            }
            catch { /* Intentionally left blank */ }

            ddlEditBindingIPAddress.Items.Clear();
            ddlEditBindingIPAddress.Items.Add(new ListItem());
            try
            {
                AcmeHelper.GetIPv4Addresses().ToList().ForEach(a => ddlEditBindingIPAddress.Items.Add(a));
            }
            catch { /* Intentionally left blank */ }

            ddlEditBindingSite.SetValue(binding != null ? binding.Site : System.Web.Hosting.HostingEnvironment.SiteName);
            ddlEditBindingIPAddress.SetValue(binding != null ? binding.IPAddress : string.Empty);
            nbEditBindingPort.Text = binding != null?binding.Port.ToString() : "443";

            tbEditBindingDomain.Text = binding != null ? binding.Domain : string.Empty;
        }
Пример #28
0
    public void ResetBindings(bool bReset)
    {
        bool bSuccess = LoadBindings(bReset);

        if (!bSuccess)
        {
            LoadBindings(!bReset);
        }

        // Set button texts...

        // Keyboard buttons...
        for (int i = 0; i < m_keyboardButtonTexts.Length; ++i)
        {
            m_keyboardButtonTexts[i].text = (m_bindingData[(int)m_eCurrentPlayer].m_keys[i]).ToString();
        }

        // Controller buttons...
        for (int i = 0; i < m_controllerButtonTexts.Length; ++i)
        {
            BindingData currentData = m_bindingData[(int)m_eCurrentPlayer];

            if (currentData.m_bIsButton[i])
            {
                // Use button names if this is a button binding.
                m_controllerButtonTexts[i].text = m_buttonNames[(int)currentData.m_buttons[i]];
            }
            else
            {
                // Use axis names if this is an axis binding.
                m_controllerButtonTexts[i].text = m_axisNames[(int)currentData.m_axes[i]];
            }
        }

        m_bChangesMade = true;
    }
Пример #29
0
        /// <summary>
        /// Initializes a new instance of the AzureHttpsDispatcher class.
        /// </summary>
        /// <param name="azureQueueManager">AzureQueueManager instance</param>
        /// <param name="info">indicating the dispatcher info</param>
        /// <param name="binding">binding information</param>
        /// <param name="sharedData">indicating the shared data</param>
        /// <param name="observer">indicating the observer</param>
        /// <param name="queueFactory">indicating the queue factory</param>
        /// <param name="schedulerAdapterClientFactory">SchedulerAdapterClientFactory instance</param>
        /// <param name="dispatcherIdle">set when the dispatcher enters idle status</param>
        public AzureHttpsDispatcher(AzureQueueManager azureQueueManager, DispatcherInfo info, Binding binding, SharedData sharedData, BrokerObserver observer, BrokerQueueFactory queueFactory, SchedulerAdapterClientFactory schedulerAdapterClientFactory, AutoResetEvent dispatcherIdle)
            : base(info, ProxyBinding.BrokerProxyBinding, sharedData, observer, queueFactory, schedulerAdapterClientFactory, dispatcherIdle)
        {
            AzureDispatcherInfo azureDispatcherInfo = info as AzureDispatcherInfo;

            this.azureServiceName = azureDispatcherInfo.AzureServiceName;

            this.azureQueueManager = azureQueueManager;

            this.azureQueueManager.CreateRequestStorage(this.azureServiceName);

            this.responseStorageName =
                this.azureQueueManager.Start(azureDispatcherInfo.JobId, azureDispatcherInfo.RequeueCount);

            // Update backend binding's maxMessageSize settings with global maxMessageSize if its enabled (> 0)
            int maxMessageSize = sharedData.ServiceConfig.MaxMessageSize;

            if (maxMessageSize > 0)
            {
                BindingHelper.ApplyMaxMessageSize(binding, maxMessageSize);
            }

            this.backendBindingData = new BindingData(binding);
        }
Пример #30
0
        private void btnKetCau_Accept_Click(object sender, EventArgs e)
        {
            KetCau _ketcau = new KetCau();

            _ketcau.TenKetCau    = txtTenKetCau.Text;
            _ketcau.MoTa         = txtMoTa.Text;
            _ketcau.NguoiTao     = SessionUser.UserName;
            _ketcau.MaNhomKetCau = Convert.ToInt32(cboNhomKetCau.SelectedValue);

            BLL_KetCau adapter = new BLL_KetCau();

            if (lblMaKetCau.Text == string.Empty)
            {
                adapter.Add(_ketcau);
            }
            else
            {
                _ketcau.MaKetCau = int.Parse(lblMaKetCau.Text);
                adapter.Update(_ketcau);
            }

            ResetFormKC();
            BindingData.BindingKetCau(treeViewKetCau);
        }
Пример #31
0
        /// <summary>
        /// Adds or replaces a text dictionary binding to a control's property.
        /// </summary>
        /// <param name="control">Control to add the binding to.</param>
        /// <param name="propertyName">Name of the control's property to bind to the dictionary.</param>
        /// <param name="key">Text key to use for the binding.</param>
        public static void AddBinding(Control control, string propertyName, string key)
        {
            lock (controlBindings)
            {
                Dictionary<string, BindingData> propertyBindings;
                if (!controlBindings.TryGetValue(control, out propertyBindings))
                {
                    // This is the first bound property for the control
                    propertyBindings = new Dictionary<string, BindingData>();
                    controlBindings.Add(control, propertyBindings);

                    // Be notified when the control is disposed
                    control.Disposed += Control_Disposed;
                }

                BindingData bindingData;
                if (propertyBindings.TryGetValue(propertyName, out bindingData))
                {
                    // This property of the control is already bound, remove that first
                    // Remove the binding from the control
                    control.DataBindings.Remove(bindingData.Binding);

                    // Dispose of the Tx binding instance
                    bindingData.TxDictionaryBinding.Dispose();
                }

                // Add the new binding to the control and keep track of it
                TxDictionaryBinding db = new TxDictionaryBinding(key);
                bindingData = new BindingData(
                    db,
                    control.DataBindings.Add(propertyName, db, "Text"));
                propertyBindings[propertyName] = bindingData;
            }
        }
Пример #32
0
        public void DispatchItemValueChangedEvent(BindingData.ItemBindingData itemBindingData)
        {

            System.Collections.Generic.List<string> templist = new List<string>();
                foreach (RegisterInfo info in dictClientCallBacks.Values.ToArray())
                {
                    try
                    {
                    if (info.IsRegistItemEvent  && info.PlaneID==itemBindingData.PlaneID)
                    {
                      
                        info.CallBack.ItemValueChangedEvenr(itemBindingData);
                        Console.WriteLine("Call back!" + itemBindingData.ItemID + "," + itemBindingData.Value + "," + itemBindingData.ColorString);
                    }
                    }
                    catch (Exception ex)
                    {
                       // Console.WriteLine(ex.Message + "," + ex.StackTrace);
                        Console.WriteLine(info.Key + ", removed!");
                        templist.Add(info.Key);
                      // dictClientCallBacks.Remove(info.Key) ;
                    }
                }
                foreach (string key in templist)
                {
                    try
                    {
                        dictClientCallBacks.Remove(key);
                    }
                    catch { ;}
                }

           
        }