Exemplo n.º 1
0
        private void SearchClearCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            SearchController.Clear();

            SearchKeyword.Text = "";
            SearchKeyword.Focus();
        }
Exemplo n.º 2
0
        private void ClientEditCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            DemonSaw.Entity.Entity entity = ClientController.SelectedItem;
            ClientEditWindow       wnd    = new ClientEditWindow(entity)
            {
                Owner = this
            };

            bool result = (bool)wnd.ShowDialog();

            if (result)
            {
                // Client
                ClientComponent client = entity.Get <ClientComponent>();
                client.Name     = wnd.ClientName.Text;
                client.Download = wnd.DownloadPath.Text;

                // Group
                GroupComponent group        = entity.Get <GroupComponent>();
                bool           groupChanged = (entity == MenuController.Entity) && !group.Path.Equals(wnd.GroupPath.Text);
                group.Path        = wnd.GroupPath.Text;
                GroupImage.Source = group.Image;

                // Options
                ClientOptionsComponent options = entity.Get <ClientOptionsComponent>();
                options.MaxDownloads = int.Parse(wnd.MaxDownloads.Text);
                options.MaxUploads   = int.Parse(wnd.MaxUploads.Text);

                // Machine
                MachineComponent machine = entity.Get <MachineComponent>();
                machine.Restart();

                // Controller
                MenuController.Update();

                if (groupChanged)
                {
                    SearchController.Clear();
                    BrowseController.Clear();
                }
            }
        }
Exemplo n.º 3
0
        private void ClientListView_GroupImageButton_Click(object sender, RoutedEventArgs e)
        {
            DemonSaw.Entity.Entity entity = ClientController.SelectedItem;
            if (entity == null)
            {
                return;
            }

            // Group
            GroupComponent group = entity.Get <GroupComponent>();

            OpenFileDialog dlg = new OpenFileDialog()
            {
                Title       = "Browse For Group Image",
                FileName    = group.Path,
                Filter      = "BMP Files (*.bmp)|*.bmp|JPEG Files (*.jpeg)|*.jpeg|JPG Files (*.jpg)|*.jpg|GIF Files (*.gif)|*.gif|ICO Files (*.ico)|*.ico|PNG Files (*.png)|*.png|All files (*.*)|*.*",
                FilterIndex = 7
            };

            if (dlg.ShowDialog() == true)
            {
                // Group
                bool groupChanged = (entity == MenuController.Entity) && !group.Path.Equals(dlg.FileName);
                group.Path        = dlg.FileName;
                GroupImage.Source = group.Image;

                // Machine
                MachineComponent machine = entity.Get <MachineComponent>();
                machine.Restart();

                // Controllers
                if (groupChanged)
                {
                    SearchController.Clear();
                    BrowseController.Clear();
                }
            }
        }