Пример #1
0
        void Load_Usuarios()
        {
            StackPanel_Usuarios.Children.Clear();

            foreach (Usuario item in u.UsuarioRepository.GetAll())
            {
                //cargar usuarios en pantalla de login
                MaterialDesignThemes.Wpf.Chip chip = new MaterialDesignThemes.Wpf.Chip();

                string rutaImagen = Environment.CurrentDirectory + "\\imagenes\\usuarios\\" + item.RutaImagen;
                if (File.Exists(rutaImagen))
                {
                    chip.IconForeground = Brushes.Transparent;
                    chip.Icon           = new ImageBrush(new BitmapImage(new Uri(rutaImagen, UriKind.Relative)));
                    chip.IconBackground = new ImageBrush(new BitmapImage(new Uri(rutaImagen, UriKind.Relative)));
                }
                chip.FontSize = 20;
                chip.Content  = item.UsuarioId + " " + item.Nombre + " " + item.Apellidos;
                Thickness margin = chip.Margin;
                margin.Top    = 10;
                margin.Bottom = 10;
                margin.Left   = 10;
                margin.Right  = 10;
                chip.Margin   = margin;


                //Evento clic
                chip.Click += (s, e) =>
                {
                    Select_usuario(chip.Content.ToString());
                };

                StackPanel_Usuarios.Children.Add(chip);
            }
        }
Пример #2
0
        private void ButtonsDemoChip_OnDeleteClick(object sender, RoutedEventArgs e)
        {
            try
            {
                MaterialDesignThemes.Wpf.Chip tb = (MaterialDesignThemes.Wpf.Chip)sender;
                object data            = tb.DataContext;
                string valorespecifico = tb.DataContext.ToString();
                string parte           = valorespecifico.Substring(0, valorespecifico.IndexOf(","));
                IdFilho = parte.Substring(10);

                MessageBoxResult result = MessageBox.Show("Excluir filho?", "Confirmação", MessageBoxButton.YesNo, MessageBoxImage.Question);

                if (result == MessageBoxResult.Yes)
                {
                    FilhosDAO deleta = new FilhosDAO();
                    deleta.deletaFilhos(IdFilho);
                    buscaFilho();
                    LimparCamposFilhos();
                    MessageBox.Show("Filho exluído, com sucesso!");
                }
            }
            catch (Exception er)
            {
                MessageBox.Show(er.Message);
            }
        }
Пример #3
0
        private void ButtonsDemoChip_OnClick(object sender, RoutedEventArgs e)
        {
            try
            {
                MaterialDesignThemes.Wpf.Chip tb = (MaterialDesignThemes.Wpf.Chip)sender;
                object data = tb.DataContext;



                string valorespecifico = tb.DataContext.ToString();
                string parte           = valorespecifico.Substring(0, valorespecifico.IndexOf(","));


                IdFilho = parte.Substring(10);
                FilhosDAO dao = new FilhosDAO();
                populaFilhosDGV(dao.buscaFilhosDGV(IdFilho.ToString()));
                btnSalvarfilho.IsEnabled   = false;
                btneditarfilho.IsEnabled   = true;
                btndeletarfilhos.IsEnabled = true;
            }
            catch (Exception er)
            {
                MessageBox.Show(er.Message);
            }
        }
Пример #4
0
        private async void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            var metadataQuery = @"
CALL db.labels() YIELD label
RETURN {name:'labels', data:COLLECT(label)[..1000]} AS result
UNION ALL
CALL db.relationshipTypes() YIELD relationshipType
RETURN {name:'relationshipTypes', data:COLLECT(relationshipType)[..1000]} AS result
UNION ALL
MATCH () RETURN { name:'nodes', data:count(*) } AS result
UNION ALL
MATCH ()-[]->() RETURN { name:'relationships', data: count(*)} AS result";

            var result = await Model.ExecuteCypherAsync(metadataQuery);

            var labels      = ((result[0].Values["result"] as Dictionary <string, object>)["data"] as List <object>);
            var labelsCount = (long)(result[2].Values["result"] as IDictionary <string, object>)["data"];

            this.LabelsPrompt.Text = string.Format("Node Labels ({0})", labelsCount);

            foreach (var label in labels)
            {
                var labelGlyph = new MaterialDesignThemes.Wpf.Chip()
                {
                    Margin      = new Thickness(5, 0, 5, 5),
                    Content     = label as string,
                    IsDeletable = false,
                    ToolTip     = "Calculating...",
                };

                labelGlyph.Click += (_, e) => { LabelClicked(label as string); };

                labelGlyph.ToolTipOpening += LabelTooltipOpening;
                this.Nodes.Children.Add(labelGlyph);
            }

            var relationships     = ((result[1].Values["result"] as Dictionary <string, object>)["data"] as List <object>);
            var relationshipCount = (long)(result[3].Values["result"] as IDictionary <string, object>)["data"];

            this.RelationshipsPrompt.Text = string.Format("Relationships ({0})", relationshipCount);

            foreach (var relationship in relationships)
            {
                var edgeGlyph = new Button()
                {
                    Style   = this.Resources["Edges"] as Style,
                    Margin  = new Thickness(-4, -0, -4, 0),
                    Content = "-[" + (relationship as string) + "]-",
                    ToolTip = "Calculating...",
                };

                edgeGlyph.Click += (_, e) => { EdgeClicked(relationship as string); };

                edgeGlyph.Width  -= 24;
                edgeGlyph.Height -= 8;

                edgeGlyph.ToolTipOpening += EdgeToolTipOpening;
                this.Relationships.Children.Add(edgeGlyph);
            }
        }
Пример #5
0
        private void Click_deletarAutor(object sender, RoutedEventArgs e)
        {
            try {
                MaterialDesignThemes.Wpf.Chip tb = (MaterialDesignThemes.Wpf.Chip)sender;
                object data            = tb.DataContext;
                string valorespecifico = tb.DataContext.ToString();
                string parte           = valorespecifico.Substring(0, valorespecifico.IndexOf(","));
                IdCliente = Convert.ToInt32(parte.Substring(10));
                string partenome = valorespecifico.Substring(20 + Convert.ToString(IdCliente).Length);
                partenome = partenome.Replace(" }", "");


                Cliente cliente = new Cliente();

                cliente.id              = IdCliente;
                cliente.nome            = partenome;
                cliente.cpf_cnpj        = null;
                cliente.rg_ie           = null;
                cliente.data_nascimento = Convert.ToDateTime(null);
                cliente.nacionalidade   = null;
                cliente.estado_civil    = null;
                cliente.telefone        = null;
                cliente.celular         = null;
                cliente.email           = null;
                cliente.sexo            = null;
                cliente.excluido        = false;


                cliente.endereco            = new Endereco();
                cliente.endereco.logradouro = null;
                cliente.endereco.cep        = null;

                cliente.Domicilio            = new Domicilio();
                cliente.Domicilio.logradouro = null;
                cliente.Domicilio.cep        = null;
                listaCliente.Remove(cliente);

                var itemToRemove = listaCliente.Single(r => r.id == IdCliente);
                listaCliente.Remove(itemToRemove);

                var novalistacliente = listaCliente.Select(clientedgv => new
                {
                    Codigo = clientedgv.id,
                    Nome   = clientedgv.nome,
                    Merda  = clientedgv.Domicilio.cep,
                }).ToList();

                ListAutor.ItemsSource = null;
                ListAutor.ItemsSource = novalistacliente;
            }
            catch (Exception er)
            {
                _vm.ShowError(er.Message);
            }
        }
        private async void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            var metadataQuery = @"
CALL db.labels() YIELD label
RETURN {name:'labels', data:COLLECT(label)[..1000]} AS result
UNION ALL
CALL db.relationshipTypes() YIELD relationshipType
RETURN {name:'relationshipTypes', data:COLLECT(relationshipType)[..1000]} AS result
UNION ALL
MATCH () RETURN { name:'nodes', data:count(*) } AS result
UNION ALL
MATCH ()-[]->() RETURN { name:'relationships', data: count(*)} AS result";

            var result = await Model.ExecuteCypherAsync(metadataQuery);

            var labels      = ((result[0].Values["result"] as Dictionary <string, object>)["data"] as List <object>);
            var labelsCount = (long)(result[2].Values["result"] as IDictionary <string, object>)["data"];

            this.LabelsPrompt.Text = string.Format("Node Labels ({0})", labelsCount);

            foreach (var o in labels)
            {
                var chip = new MaterialDesignThemes.Wpf.Chip()
                {
                    Margin      = new Thickness(5, 0, 5, 5),
                    Content     = o as string,
                    IsDeletable = false,
                    ToolTip     = "Calculating...",
                };

                chip.ToolTipOpening += LabelTooltipOpening;
                this.Nodes.Children.Add(chip);
            }

            var relationships     = ((result[1].Values["result"] as Dictionary <string, object>)["data"] as List <object>);
            var relationshipCount = (long)(result[3].Values["result"] as IDictionary <string, object>)["data"];

            this.RelationshipsPrompt.Text = string.Format("Relationships ({0})", relationshipCount);

            foreach (var o in relationships)
            {
                var border = new Border()
                {
                    Margin = new Thickness(5, 0, 5, 0),
                    Child  = new Label()
                    {
                        Content = "-[" + (o as string) + "]-"
                    },
                    ToolTip = "Calculating...",
                };

                border.ToolTipOpening += EdgeToolTipOpening;
                this.Relationships.Children.Add(border);
            }
        }
        public PermissionRequired(EmployeewsOfCloudPOS cloudPosUnitofwork, MaterialDesignThemes.Wpf.Chip cUser)
        {
            _cloudPosUnitofwork = cloudPosUnitofwork;
            _cUser = cUser;
            InitializeComponent();

            txtUsername.Focus();

            this.WindowStyle = WindowStyle.SingleBorderWindow;
            this.ResizeMode  = ResizeMode.NoResize;
        }
 private void ChipEx_DeleteClick(object sender, RoutedEventArgs e)
 {
     MaterialDesignThemes.Wpf.Chip novo = (MaterialDesignThemes.Wpf.Chip)sender;
     foreach (FuncionariosTag tag in ListaDeFuncionarios.Items)
     {
         if (tag.Nome == novo.Content.ToString())
         {
             ListaDeFuncionarios.Items.Remove(tag);
             break;
         }
     }
 }
        private void RegisterMessage()
        {
            RestClient client = new RestClient(urlBase);

            client.Timeout = -1;
            var request = new RestRequest("messages", Method.POST);

            foreach (RestResponseCookie cookie in Login.cookies)
            {
                request.AddCookie(cookie.Name, cookie.Value);
            }
            var json = JsonConvert.SerializeObject(messagesSend);

            request.AddHeader("Token", Login.tokenAccount.token);
            request.AddParameter("application/json", json, ParameterType.RequestBody);
            System.Net.ServicePointManager.ServerCertificateValidationCallback = (senderX, certificate, chain, sslPolicyErrors) => { return(true); };
            try
            {
                IRestResponse response = client.Execute(request);
                if (response.StatusCode == System.Net.HttpStatusCode.Created || response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    messagesSend = JsonConvert.DeserializeObject <Models.Message>(response.Content);
                    MaterialDesignThemes.Wpf.Chip ChipMessage = new MaterialDesignThemes.Wpf.Chip();
                    ChipMessage.Content                    = messagesSend.message;
                    ChipMessage.Margin                     = new Thickness(350, 0, 0, 0);
                    ChipMessage.HorizontalAlignment        = HorizontalAlignment.Right;
                    ChipMessage.VerticalAlignment          = VerticalAlignment.Center;
                    ChipMessage.HorizontalContentAlignment = HorizontalAlignment.Right;
                    ChipMessage.Background                 = Brushes.LightGray;
                    ListViewChat.Items.Add(ChipMessage);
                }
                else
                {
                    Models.Error responseError = JsonConvert.DeserializeObject <Models.Error>(response.Content);
                    TelegramBot.SendToTelegram(responseError.error);
                    MessageBox.Show(responseError.error, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    if (response.StatusCode == System.Net.HttpStatusCode.Forbidden || response.StatusCode == System.Net.HttpStatusCode.Unauthorized ||
                        response.StatusCode == System.Net.HttpStatusCode.RequestTimeout)
                    {
                        MessageBox.Show(responseError.error, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        Login login = new Login();
                        login.Show();
                        Close();
                    }
                }
            }
            catch (Exception exception)
            {
                TelegramBot.SendToTelegram(exception);
                LogException.Log(this, exception);
            }
        }
        public DeleteConfirmDialog(MaterialDesignThemes.Wpf.Chip cUser, bool isTable)
        {
            _cUser   = cUser;
            done     = false;
            _isTable = isTable;
            reason   = "";
            InitializeComponent();

            if (_isTable)
            {
                product.Visibility = Visibility.Collapsed;
            }
        }
Пример #11
0
        // -------------------------------------------------------------------------
        // On clique sur une RecentChip: on charge le fichier ou la ruche (Hive)
        // -------------------------------------------------------------------------
        private void Bt_RecentChip_Click(object sender, RoutedEventArgs e)
        {
            // On recupère la Chip qui a été cliquée
            MaterialDesignThemes.Wpf.Chip SenderChip = sender as MaterialDesignThemes.Wpf.Chip;
            // On enregistre son nom
            string RecentRegToLoadName = SenderChip.Content.ToString();

            CurrentRegistry = new RecentRegistry(RecentRegToLoadName);
            // On ferme le popup "recent chip"
            Pu_Recent.IsOpen = false;
            // On affiche le Popup Sablier
            Pu_Working.IsOpen = true;

            // On renseigne l'InfoChip
            Tree_InfoChip.Content  = CurrentRegistry.Name;
            Tree_InfoChipIcon.Kind = CurrentRegistry.Icon;

            // Si le RecentReg est un fichier
            if (CurrentRegistry.GetGenre() == RecentRegistry.Genre.file)
            {
                // On enleve le message "drop your file"
                this.ReInitDisplay();
                // On remplit le RegistryTree à partir du fichier REG
                Parser1.ParseFile(CurrentRegistry.Name);
                Parser1.BuildList();
                // On enlève le Popup Sablier
                Pu_Working.IsOpen = false;
            }
            // Si le RecentReg est un subtree de la Registry
            else if (CurrentRegistry.GetGenre() == RecentRegistry.Genre.hive)
            {
                // On enleve le message "drop your file"
                this.ReInitDisplay();
                // On remplit le RegistryTree à partir du subtree de Registre
                AsynchronousHiveLoading(CurrentRegistry.Name);
                // Parser2.ParseHive(CurrentRegistry.Name);
                // Parser2.BuildList();
            }
            // Autres cas...
            else
            {
                // On enlève le Popup Sablier
                Pu_Working.IsOpen = false;
                // Gestion de l'affichage
                this.ReInitDisplay();
            }
        }
Пример #12
0
        //funcionando Abre tela cliente...
        private void click_autor(object sender, RoutedEventArgs e)
        {
            try
            {
                MaterialDesignThemes.Wpf.Chip tb = (MaterialDesignThemes.Wpf.Chip)sender;

                Negocio.Definicoes.idClienteSelecionado   = Convert.ToInt32(tb.ToolTip.ToString());
                Negocio.Definicoes.nomeClienteselecionado = tb.Content.ToString();;

                WAdicionarProcesso adicionaprocesso = new WAdicionarProcesso();
                adicionaprocesso.Show();
            }
            catch (Exception er)
            {
                _vm.ShowError(er.Message);
            }
        }
Пример #13
0
        private void Chip_DeleteClick(object sender, RoutedEventArgs e)
        {
            MaterialDesignThemes.Wpf.Chip b = (MaterialDesignThemes.Wpf.Chip)sender;

            List <File_Item> list = FileList.ToList();

            foreach (File_Item i in list)
            {
                if (b.Content == null)
                {
                    continue;
                }
                if (b.Content.Equals(i.fileName) && b.ToolTip.Equals(i.path))
                {
                    FileList.Remove(i);
                    return;
                }
            }
        }
Пример #14
0
        public AllEmployeeLogin(Window main, EmployeewsOfLocalPOS unitofwork, EmployeewsOfCloudPOS cloudPosUnitofwork, MaterialDesignThemes.Wpf.Chip cUser, int typeshow)
        {
            _unitofwork         = unitofwork;
            _cloudPosUnitofwork = cloudPosUnitofwork;
            _employee           = _cloudPosUnitofwork.EmployeeRepository.Get(x => x.Deleted == 0).ToList();
            _main = main;

            _cUser    = cUser;
            _typeshow = typeshow;
            InitializeComponent();

            initData();

            this.Loaded += AllEmployeeLogin_Loaded;

            LoadForm          = new DispatcherTimer();
            LoadForm.Tick    += LoadForm_Tick;
            LoadForm.Interval = new TimeSpan(0, 0, 0, 0, 1);
        }
Пример #15
0
        private void click_autor(object sender, RoutedEventArgs e)
        {
            try {
                MaterialDesignThemes.Wpf.Chip tb = (MaterialDesignThemes.Wpf.Chip)sender;
                object data            = tb.DataContext;
                string valorespecifico = tb.DataContext.ToString();
                string parte           = valorespecifico.Substring(0, valorespecifico.IndexOf(","));
                IdCliente = Convert.ToInt32(parte.Substring(10));
                string partenome = valorespecifico.Substring(20 + Convert.ToString(IdCliente).Length);
                NomeCliente = partenome.Replace(" }", "");

                WAdicionarProcesso adicionaprocesso = new WAdicionarProcesso();
                adicionaprocesso.Show();
            }
            catch (Exception er)
            {
                _vm.ShowError(er.Message);
            }
        }
Пример #16
0
        private void Click_deletarAutor(object sender, RoutedEventArgs e)
        {
            try
            {
                MaterialDesignThemes.Wpf.Chip tb = (MaterialDesignThemes.Wpf.Chip)sender;
                object data            = tb.DataContext;
                string valorespecifico = tb.DataContext.ToString();
                string parte           = valorespecifico.Substring(0, valorespecifico.IndexOf(","));
                IdCliente = Convert.ToInt32(parte.Substring(10));
                string partenome = valorespecifico.Substring(20 + Convert.ToString(IdCliente).Length);
                partenome = partenome.Replace(" }", "");



                ProcessoPessoaVinc proc = new ProcessoPessoaVinc();


                proc.Cliente      = new Cliente();
                proc.Cliente.id   = IdCliente;
                proc.Cliente.nome = NomeCliente;

                listaCliente.Remove(proc);

                var itemToRemove = listaCliente.Single(r => r.Cliente.id == IdCliente);
                listaCliente.Remove(itemToRemove);

                var novalistacliente = listaCliente.Select(clientedgv => new
                {
                    Codigo = clientedgv.Cliente.id,
                    Nome   = clientedgv.Cliente.nome,
                    Merda  = clientedgv.CLI_PRO_CLIENTEESCRITORIO,
                }).ToList();

                ListAutor.ItemsSource = null;
                ListAutor.ItemsSource = novalistacliente;
            }
            catch (Exception er)
            {
                _vm.ShowError(er.Message);
            }
        }
 private void EmployeeMessageInListView()
 {
     foreach (Models.Message message in messages)
     {
         MaterialDesignThemes.Wpf.Chip ChipMessage = new MaterialDesignThemes.Wpf.Chip();
         ChipMessage.Content           = message.message;
         ChipMessage.VerticalAlignment = VerticalAlignment.Center;
         if (message.memberType == Number.NumberValue(NumberValues.ONE))
         {
             ChipMessage.HorizontalAlignment        = HorizontalAlignment.Left;
             ChipMessage.HorizontalContentAlignment = HorizontalAlignment.Left;
             ChipMessage.Background = Brushes.LightBlue;
         }
         else
         {
             ChipMessage.Margin = new Thickness(350, 0, 0, 0);
             ChipMessage.HorizontalAlignment        = HorizontalAlignment.Right;
             ChipMessage.HorizontalContentAlignment = HorizontalAlignment.Right;
             ChipMessage.Background = Brushes.LightGray;
         }
         ListViewChat.Items.Add(ChipMessage);
     }
 }
Пример #18
0
        private async Task AddNewNotification(string message, string id)
        {
            string directoryPath = "Resources/Images/";

            BitmapImage image = new BitmapImage();

            if (!File.Exists(directoryPath + id))
            {
                await Task.Run(() => Models.S3Bucket.DownloadFile(id, Models.MyAWSConfigs.RefImagesBucketName));
            }

            string exeDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\";

            Uri fileUri = new Uri(exeDirectory + directoryPath + id);

            image   = new BitmapImage(fileUri);
            message = DateTime.Now.ToShortTimeString() + " " + message;

            var myChip = new MaterialDesignThemes.Wpf.Chip()
            {
                Content     = message,
                IsDeletable = false,
                Icon        = new Image()
                {
                    Source = image, Stretch = Stretch.Uniform
                },
            };

            Thickness margin = myChip.Margin;

            margin.Left   = 10;
            margin.Top    = 10;
            margin.Bottom = 10;
            myChip.Margin = margin;

            this.notificationListView.Items.Add(myChip);
        }
Пример #19
0
        /// <summary>
        /// Функция создания поля сообщений
        /// </summary>
        /// <param name="msg">Сообщение</param>
        private void createMesBoard(string msg)
        {
            //MessageBox.Show(msg);
            string name      = msg.Substring(0, msg.IndexOf(' '));      //Первая часть соообщения - имя
            string loginName = msg.Substring(msg.LastIndexOf(' ') + 1); //Получение логина из сообщения

            name = name.Trim();                                         //Удаление мусора
            StackPanel messageSP = new StackPanel();                    //Стак панель, хранящая в себе имя и сообщение

            messageSP.Margin            = new Thickness(0, 0, 0, 20);
            messageSP.VerticalAlignment = VerticalAlignment.Bottom; //Отображение сообщений внизу
            messageSP.Height            = double.NaN;               //растянуть по всей высоте Height = "auto"

            //Блок имени пользователя
            TextBlock UserNameTB = new TextBlock();

            UserNameTB.FontWeight = FontWeights.Bold;
            UserNameTB.FontSize   = 20;
            UserNameTB.Margin     = new Thickness(5, 0, 0, 0);
            UserNameTB.Text       = name;
            UserNameTB.Foreground = Brushes.DeepSkyBlue;
            UserNameTB.FontFamily = new FontFamily("Comic Sans MS");

            //Блок сообщения
            TextBlock messageTB = new TextBlock();

            messageTB.Text         = msg.Substring(name.Length, msg.Length - loginName.Length - name.Length);
            messageTB.TextWrapping = TextWrapping.Wrap;
            messageTB.Margin       = new Thickness(5, 0, 0, 0);
            messageTB.FontFamily   = new FontFamily("Comic Sans MS");
            messageTB.FontSize     = 18;

            //Отправленное сообщение справа
            if (loginName == Login.loginStat)
            {
                UserNameTB.HorizontalAlignment = HorizontalAlignment.Right;
                messageTB.HorizontalAlignment  = HorizontalAlignment.Right;
                messageSP.HorizontalAlignment  = HorizontalAlignment.Right;
                messageSP.Margin  = new Thickness(250, 0, 5, 0);
                UserNameTB.Margin = new Thickness(5, 0, 5, 0);
            }
            else//Полученное слева
            {
                UserNameTB.HorizontalAlignment = HorizontalAlignment.Left;
                messageTB.HorizontalAlignment  = HorizontalAlignment.Left;
                messageSP.HorizontalAlignment  = HorizontalAlignment.Left;
                messageSP.Margin  = new Thickness(5, 0, 250, 0);
                UserNameTB.Margin = new Thickness(5, 0, 5, 0);
            }

            MaterialDesignThemes.Wpf.Chip message = new MaterialDesignThemes.Wpf.Chip();//Элемент сообщения

            Image img = new Image();

            //Изображение в элементе сообщения

            //Сообщение текущего пользователя с картинкой профиля
            if (Login.loginStat == loginName && statusImage == true)
            {
                img.Source = ImageOutDB(loginName);
            }
            //Сообщение текущего пользователя с без картинки профиля
            else if (Login.loginStat == loginName && statusImage != true)
            {
                img.Source = new BitmapImage(new Uri("Resources/noImage.png", UriKind.Relative));
            }
            //Входящее сообщение
            else if (Login.loginStat != loginName)
            {
                SearchImage(loginName);//Поиск картинки
                //Найдена
                if (findImage != "" || findImage != null)
                {
                    img.Source = ImageOutDB(loginName);
                }
                //не найдена
                else
                {
                    img.Source = new BitmapImage(new Uri("Resources/noImage.png", UriKind.Relative));
                }
            }

            //настройка изображения в сообщении
            img.UseLayoutRounding   = true;
            img.SnapsToDevicePixels = true;
            img.Stretch             = Stretch.Fill;
            img.Width    = 32;
            img.Height   = 32;
            message.Icon = img;
            message.HorizontalAlignment = HorizontalAlignment.Right;
            message.Height  = double.NaN;
            message.Margin  = new Thickness(5, 5, 0, 5);
            message.Content = messageTB;

            //Добавление блока сообщения и имени пользователя в стак панель, а ее в основную доску сообщений
            messageSP.Children.Add(message);
            //messageSP.Children.Add(messageTB);
            mesBoard.Children.Add(messageSP);
        }
Пример #20
0
 // -------------------------------------------------------------------------
 // Enleve un Recent Reg de la liste
 // -------------------------------------------------------------------------
 private void Bt_RecentChip_Remove(object sender, RoutedEventArgs e)
 {
     MaterialDesignThemes.Wpf.Chip SenderChip = sender as MaterialDesignThemes.Wpf.Chip;
     this.RecentsRegs.Remove(SenderChip.Content.ToString());
     this.SaveRecentRegs();
 }
Пример #21
0
        private void RefreshData()
        {
            this.clearSidebar();
            StackPanel sidebar = this.getActiveSidebar();

            //g
            Label lblg = new Label();

            lblg.FontWeight = System.Windows.FontWeights.Bold;
            lblg.Content    = "g-Values";
            sidebar.Children.Add(lblg);

            foreach (double g in this.getActivePlotView().spc.g)
            {
                PlottableEPRSpectrum spc  = this.getActiveSpectrum();
                ArrowAnnotation      Line = new ArrowAnnotation()
                {
                    StrokeThickness = 1,
                    Color           = OxyColors.Black,
                    Text            = g.ToString("g6"),
                    StartPoint      = new DataPoint(spc.calcB(g), spc.getY().Max() - spc.getY().Max() * 0.18),
                    EndPoint        = new DataPoint(spc.calcB(g), spc.getY().Max() - spc.getY().Max() * 0.8),
                };

                MaterialDesignThemes.Wpf.Chip chip = new MaterialDesignThemes.Wpf.Chip();
                chip.IsDeletable  = true;
                chip.Content      = g.ToString("g6");
                chip.Tag          = g;
                chip.DeleteClick += (s, e) => GChip_DeleteClick(s, e);
                sidebar.Children.Add(chip);

                this.getActivePlotView().Model.Annotations.Add(Line);
            }

            //couplings
            Label lblA = new Label();

            lblA.FontWeight = System.Windows.FontWeights.Bold;
            lblA.Content    = "Hyperfinecouplings";
            sidebar.Children.Add(lblA);

            foreach (Tuple <DataPoint, DataPoint> tp in this.getActivePlotView().spc.A)
            {
                double          distance = Math.Abs(tp.Item1.X - tp.Item2.X);
                ArrowAnnotation Line     = new ArrowAnnotation()
                {
                    StrokeThickness = 1,
                    Color           = OxyColors.Black,
                    Text            = distance.ToString("g4") + " mT",
                    StartPoint      = tp.Item1,
                    EndPoint        = new DataPoint(tp.Item2.X, tp.Item1.Y)
                };
                this.getActivePlotView().Model.Annotations.Add(Line);

                MaterialDesignThemes.Wpf.Chip chip = new MaterialDesignThemes.Wpf.Chip();
                chip.IsDeletable  = true;
                chip.Content      = distance.ToString("g4") + " mT";
                chip.Tag          = tp;
                chip.DeleteClick += (s, e) => AChip_DeleteClick(s, e);
                sidebar.Children.Add(chip);
            }



            this.getActivePlotView().Model.InvalidatePlot(false);
        }
Пример #22
0
        private async Task RepaintAsync()
        {
            this.Nodes.Children.Clear();
            this.Relationships.Children.Clear();

            // Get the names of the first 1000 labels, the first 1000 relationships
            // and the count of nodes and relationships.
            var metadataQuery = @"
                CALL db.labels() YIELD label
                RETURN {name:'labels', data:COLLECT(label)[..1000]} AS result
                UNION ALL
                CALL db.relationshipTypes() YIELD relationshipType
                RETURN {name:'relationshipTypes', data:COLLECT(relationshipType)[..1000]} AS result
                UNION ALL
                MATCH () RETURN { name:'nodes', data:count(*) } AS result
                UNION ALL
                MATCH ()-[]->() RETURN { name:'relationships', data: count(*)} AS result";

            var g = await Neo4jDatabase.ExecuteQueryGraphAsync(metadataQuery);

            var parts      = g.Values.ToArray();
            var labelsPart = parts[0];

            var labelValues             = (labelsPart as Dictionary <string, object>)["data"];
            IEnumerable <string> labels = (labelValues as List <object>).Select(o => o as string);

            this.LabelsPrompt.Text = string.Format("Node Labels ({0})", labels.Count());

            foreach (var label in labels)
            {
                var labelGlyph = new MaterialDesignThemes.Wpf.Chip()
                {
                    Margin      = new Thickness(5, 0, 5, 5),
                    Content     = label,
                    IsDeletable = false,
                    ToolTip     = "Calculating...",
                };

                labelGlyph.Click += (_, e) => { this.LabelClicked(label as string); };

                labelGlyph.ToolTipOpening += this.LabelTooltipOpening;
                this.Nodes.Children.Add(labelGlyph);
            }

            var relationshipsPart = parts[1];

            var  relationshipsValues = (relationshipsPart as Dictionary <string, object>)["data"];
            var  relationshipsList   = (relationshipsValues as List <object>).Select(o => o as string);
            long relationshipCount   = relationshipsList.Count();

            this.RelationshipsPrompt.Text = string.Format("Relationships ({0})", relationshipCount);

            foreach (var relationship in relationshipsList)
            {
                var edgeGlyph = new Button()
                {
                    Style   = this.Resources["Edges"] as Style,
                    Margin  = new Thickness(-4, -0, -4, 0),
                    Content = "-[" + (relationship as string) + "]-",
                    ToolTip = "Calculating...",
                };

                edgeGlyph.Click += (_, e) => { this.EdgeClicked(relationship as string); };

                edgeGlyph.Width  -= 24;
                edgeGlyph.Height -= 8;

                edgeGlyph.ToolTipOpening += this.EdgeToolTipOpening;
                this.Relationships.Children.Add(edgeGlyph);
            }
        }