Example #1
0
        void btnAddCustomTag_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                this.Cursor = Cursors.Wait;
                string res = "";

                if (string.IsNullOrWhiteSpace(txtTagName.Text))
                {
                    MessageBox.Show("Please enter a tag name", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtTagName.Focus();
                    return;
                }

                JMMServerBinary.Contract_CustomTag contract = new JMMServerBinary.Contract_CustomTag();
                contract.TagName        = txtTagName.Text.Trim();
                contract.TagDescription = txtTagDescription.Text.Trim();


                JMMServerBinary.Contract_CustomTag_SaveResponse resp = JMMServerVM.Instance.clientBinaryHTTP.SaveCustomTag(contract);

                if (!string.IsNullOrEmpty(resp.ErrorMessage))
                {
                    MessageBox.Show(res, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                else
                {
                    CustomTagVM ctag = new CustomTagVM(resp.CustomTag);
                    JMMServerVM.Instance.AllCustomTags.Add(ctag);
                    JMMServerVM.Instance.ViewCustomTagsAll.Refresh();
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
            finally
            {
                this.Cursor = Cursors.Arrow;
            }
        }
        void btnAddCustomTag_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                this.Cursor = Cursors.Wait;
                string res = "";

                if (string.IsNullOrWhiteSpace(txtTagName.Text))
                {
                    MessageBox.Show(Properties.Resources.CustomTag_EnterName, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                    txtTagName.Focus();
                    return;
                }

                JMMServerBinary.Contract_CustomTag contract = new JMMServerBinary.Contract_CustomTag();
                contract.TagName = txtTagName.Text.Trim();
                contract.TagDescription = txtTagDescription.Text.Trim();

                JMMServerBinary.Contract_CustomTag_SaveResponse resp = JMMServerVM.Instance.clientBinaryHTTP.SaveCustomTag(contract);

                if (!string.IsNullOrEmpty(resp.ErrorMessage))
                {
                    MessageBox.Show(res, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                else
                {
                    CustomTagVM ctag = new CustomTagVM(resp.CustomTag);
                    JMMServerVM.Instance.AllCustomTags.Add(ctag);
                    JMMServerVM.Instance.ViewCustomTagsAll.Refresh();
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
            finally
            {
                this.Cursor = Cursors.Arrow;
            }
        }
Example #3
0
 public CustomTagVM(JMMServerBinary.Contract_CustomTag contract)
 {
     this.CustomTagID    = contract.CustomTagID.Value;
     this.TagName        = contract.TagName;
     this.TagDescription = contract.TagDescription;
 }