Beispiel #1
0
 public void DebugInfo(string str)
 {
     if (str.Length > 0)
     {
         str += "\n";
         TextBoxInfo.AppendText(DateTime.Now.ToString() + ":" + str);
     }
 }
Beispiel #2
0
 public void DebugInfo(string str)
 {
     if (str.Length > 0)
     {
         str += "\n";
         TextBoxInfo.AppendText(str);
     }
 }
 public void TestGetTextBoxInfoForEmptyTextBoxes()
 {
     Microsoft.Office.Interop.PowerPoint.ShapeRange shapes = PpOperations.SelectShapesByPrefix("TextBox");
     TextBoxes textBoxes = new TextBoxes(shapes, 
         Pres.PageSetup.SlideWidth, Pres.PageSetup.SlideHeight);
     TextBoxInfo textBoxInfo = textBoxes.GetTextBoxesInfo();
     Assert.AreEqual(null, textBoxInfo);
 }
        public void TestStartBoxing()
        {
            PpOperations.SelectSlide(2);
            Microsoft.Office.Interop.PowerPoint.ShapeRange shapes = PpOperations.SelectShapesByPrefix("TextBox");
            TextBoxes textBoxes = new TextBoxes(shapes,
                                                Pres.PageSetup.SlideWidth, Pres.PageSetup.SlideHeight);

            textBoxes
            .SetAlignment(Alignment.Centre)
            .SetPosition(Position.Left)
            .StartBoxing();
            TextBoxInfo textBoxInfo = textBoxes.GetTextBoxesInfo();

            Assert.IsTrue(SlideUtil.IsRoughlySame(57.5200043f, textBoxInfo.Height));
            Assert.IsTrue(SlideUtil.IsRoughlySame(25f, textBoxInfo.Left));
            Assert.IsTrue(SlideUtil.IsRoughlySame(241.240036f, textBoxInfo.Top));
            Assert.IsTrue(SlideUtil.IsRoughlySame(710.945068f, textBoxInfo.Width));

            textBoxes
            .SetAlignment(Alignment.Centre)
            .SetPosition(Position.Centre)
            .StartBoxing();
            textBoxInfo = textBoxes.GetTextBoxesInfo();
            Assert.IsTrue(SlideUtil.IsRoughlySame(124.527481f, textBoxInfo.Left));
            Assert.IsTrue(SlideUtil.IsRoughlySame(241.240036f, textBoxInfo.Top));

            textBoxes
            .SetAlignment(Alignment.Centre)
            .SetPosition(Position.BottomLeft)
            .StartBoxing();
            textBoxInfo = textBoxes.GetTextBoxesInfo();
            Assert.IsTrue(SlideUtil.IsRoughlySame(25f, textBoxInfo.Left));
            Assert.IsTrue(SlideUtil.IsRoughlySame(457.480042f, textBoxInfo.Top));

            textBoxes
            .SetAlignment(Alignment.Centre)
            .SetPosition(Position.Bottom)
            .StartBoxing();
            textBoxInfo = textBoxes.GetTextBoxesInfo();
            Assert.IsTrue(SlideUtil.IsRoughlySame(124.527481f, textBoxInfo.Left));
            Assert.IsTrue(SlideUtil.IsRoughlySame(457.480042f, textBoxInfo.Top));

            textBoxes
            .SetAlignment(Alignment.Centre)
            .SetPosition(Position.Right)
            .StartBoxing();
            textBoxInfo = textBoxes.GetTextBoxesInfo();
            Assert.IsTrue(SlideUtil.IsRoughlySame(224.054962f, textBoxInfo.Left));
            Assert.IsTrue(SlideUtil.IsRoughlySame(241.23996f, textBoxInfo.Top));
        }
        public AddEditAtributs(bool upd1, int id1, int idT1, DBTablesGroups par, FiledEditListControl f_edit)
        {
            InitializeComponent();
            upd = upd1;
            id  = id1;
            idT = idT1;
            loadTipField();
            loadInfo();
            parent     = par;
            field_edit = f_edit;
            if (!upd)
            {
                tb = new TextBoxInfo(textBox1);
                textBox1.TextChanged += new EventHandler(textBox1_TextChanged);
                textBox1.MouseUp     += new MouseEventHandler(textBox1_MouseUp);
                textBox1.KeyUp       += new KeyEventHandler(textBox1_KeyUp);
            }
            tb2 = new TextBoxInfo(this.textBox2);
            textBox2.TextChanged += new EventHandler(textBox2_TextChanged);
            textBox2.MouseUp     += new MouseEventHandler(textBox2_MouseUp);
            textBox2.KeyUp       += new KeyEventHandler(textBox2_KeyUp);
            var fi = classesOfMetods.getFieldInfo(id);
            var ti = classesOfMetods.getTableInfo(idT);

            if (!SyncController.HasRight(idT))
            {
                button2.Enabled = false;
            }

            if (fi.type == 5)
            {
                button2.Enabled        = false;
                textBox2.Enabled       = false;
                textBox3.Enabled       = false;
                checkBox1.Enabled      = false;
                checkBoxHidden.Enabled = false;
            }
            if (ti.pkField == fi.nameDB)
            {
                checkBox1.Enabled      = false;
                checkBoxHidden.Enabled = false;
            }
            dic = initalizeDictionary();
        }
        public void TestGetTextBoxInfo()
        {
            PpOperations.SelectSlide(2);
            Microsoft.Office.Interop.PowerPoint.ShapeRange shapes = PpOperations.SelectShapesByPrefix("TextBox");
            TextBoxes textBoxes = new TextBoxes(shapes,
                                                Pres.PageSetup.SlideWidth, Pres.PageSetup.SlideHeight);
            TextBoxInfo textBoxInfo = textBoxes.GetTextBoxesInfo();

            Assert.IsTrue(SlideUtil.IsRoughlySame(57.5200043f, textBoxInfo.Height));
            Assert.IsTrue(SlideUtil.IsRoughlySame(68.2f, textBoxInfo.Left));
            Assert.IsTrue(SlideUtil.IsRoughlySame(52.17752f, textBoxInfo.Top));
            Assert.IsTrue(SlideUtil.IsRoughlySame(710.945068f, textBoxInfo.Width));

            TextBoxes.AddMargin(textBoxInfo, 25);
            Assert.IsTrue(SlideUtil.IsRoughlySame(107.520004f, textBoxInfo.Height));
            Assert.IsTrue(SlideUtil.IsRoughlySame(43.1999969f, textBoxInfo.Left));
            Assert.IsTrue(SlideUtil.IsRoughlySame(27.17752f, textBoxInfo.Top));
            Assert.IsTrue(SlideUtil.IsRoughlySame(760.945068f, textBoxInfo.Width));
        }
Beispiel #7
0
        public CreateCopyTable(int idT)
        {
            InitializeComponent();
            var ti = classesOfMetods.getTableInfo(idT);

            if (Program.sscUser == null || classesOfMetods.getTableInfo(idT).type != 1)
            {
                this.panelForGroup.Visible = false;
            }
            else
            {
                loadSSCGroup();
            }
            tb       = new TextBoxInfo(this.textBox1);
            this.idT = idT;
            loadField(idT);
            textBox1.Text = classesOfMetods.getTableInfo(idT).nameDB + "_copy";
            textBox2.Text = classesOfMetods.getTableInfo(idT).nameMap + " " + Rekod.Properties.Resources.CCT_Postfix;
        }
        public void TestStartBoxingWithTextWrapping()
        {
            PpOperations.SelectSlide(2);
            Microsoft.Office.Interop.PowerPoint.ShapeRange shapes = PpOperations.SelectShapesByPrefix("TextBox");
            TextBoxes textBoxes = new TextBoxes(shapes,
                Pres.PageSetup.SlideWidth, Pres.PageSetup.SlideHeight);

            textBoxes.StartTextWrapping();

            textBoxes
                .SetAlignment(Alignment.Centre)
                .SetPosition(Position.Left)
                .StartBoxing();

            TextBoxInfo textBoxInfo = textBoxes.GetTextBoxesInfo();
            Assert.IsTrue(SlideUtil.IsRoughlySame(105.040009f, textBoxInfo.Height));
            Assert.IsTrue(SlideUtil.IsRoughlySame(25.00004f, textBoxInfo.Left));
            Assert.IsTrue(SlideUtil.IsRoughlySame(217.480042f, textBoxInfo.Top));
            // aft text wrapping, width is smaller (originally should be 710)
            Assert.IsTrue(SlideUtil.IsRoughlySame(365.47f, textBoxInfo.Width));
        }
Beispiel #9
0
        private void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            BluetoothDeviceInfo device = (sender as ListView).SelectedItem as BluetoothDeviceInfo;

            if (device != null)
            {
                if (device.InstalledServices.Length > 0)
                {
                    Task.Factory.StartNew(() =>
                    {
                        Dispatcher.Invoke(new Action(() =>
                        {
                            IsGatheringInformation = true;
                            TextBoxInfo.Clear();
                        }));
                        try
                        {
                            foreach (var guid in device.InstalledServices)
                            {
                                ServiceRecord[] serviceRecords = device.GetServiceRecords(guid);

                                Dispatcher.Invoke(new Action(() =>
                                {
                                    TextBoxInfo.Text += string.Format("=========== Service: {0} ({1}) ==========={2}{2}", BluetoothService.GetName(guid), guid, Environment.NewLine);
                                    foreach (var serviceRecord in serviceRecords)
                                    {
                                        TextBoxInfo.Text += ServiceRecordUtilities.Dump(serviceRecord) + Environment.NewLine;
                                    }
                                }));
                            }
                        }
                        catch { Dispatcher.Invoke(new Action(() => { TextBoxInfo.Text = string.Format("No available information for '{0}'. Try to connect/turn-on the device.", device.DeviceName); })); }
                    }).ContinueWith((Task task) => { Dispatcher.Invoke(new Action(() => { IsGatheringInformation = false; })); });
                }
                else
                {
                    TextBoxInfo.Text = "No installed services.";
                }
            }
        }
Beispiel #10
0
 private void CommandRefreshDeviceList_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     Devices.Clear();
     IsDiscovering = true;
     ListViewDevices.UnselectAll();
     TextBoxInfo.Clear();
     Task.Factory.StartNew(() =>
     {
         BluetoothDeviceInfo[] devices = null;
         using (BluetoothClient btClient = new BluetoothClient())
         {
             devices = btClient.DiscoverDevices(100, Properties.Settings.Default.Authentificated, Properties.Settings.Default.Remembered,
                                                Properties.Settings.Default.Unknown, Properties.Settings.Default.DiscoverableOnly);
         }
         Dispatcher.Invoke(new Action(() =>
         {
             Devices       = new List <BluetoothDeviceInfo>(devices.Where(i => Properties.Settings.Default.ConnectedOnly ? i.Connected : true));
             IsDiscovering = false;
             CommandManager.InvalidateRequerySuggested();
         }));
     });
 }