예제 #1
0
        private void CommandBinding_DeleteFile(object sender, ExecutedRoutedEventArgs e)
        {
            try
            {
                Window parentWindow = Window.GetWindow(this);

                object obj = e.Parameter;
                if (obj == null)
                {
                    return;
                }

                if (obj.GetType() == typeof(VideoLocalVM))
                {
                    VideoLocalVM vid = obj as VideoLocalVM;

                    MessageBoxResult res = MessageBox.Show(string.Format(Properties.Resources.Unrecognized_ConfirmDelete, vid.FullPath),
                                                           Properties.Resources.Confirm, MessageBoxButton.YesNo, MessageBoxImage.Question);
                    if (res == MessageBoxResult.Yes)
                    {
                        EnableDisableControls(false);

                        string result = JMMServerVM.Instance.clientBinaryHTTP.DeleteVideoLocalAndFile(vid.VideoLocalID);
                        if (result.Length > 0)
                        {
                            MessageBox.Show(result, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                        else
                        {
                            RefreshIgnoredFiles();
                        }
                    }
                }

                if (obj.GetType() == typeof(MultipleVideos))
                {
                    MultipleVideos   mv  = obj as MultipleVideos;
                    MessageBoxResult res = MessageBox.Show(string.Format(Properties.Resources.Unrecognized_DeleteSelected, mv.VideoLocalIDs.Count),
                                                           Properties.Resources.Confirm, MessageBoxButton.YesNo, MessageBoxImage.Question);
                    if (res == MessageBoxResult.Yes)
                    {
                        EnableDisableControls(false);

                        foreach (int id in mv.VideoLocalIDs)
                        {
                            JMMServerVM.Instance.clientBinaryHTTP.DeleteVideoLocalAndFile(id);
                        }

                        RefreshIgnoredFiles();
                    }
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }

            EnableDisableControls(true);
        }
예제 #2
0
        private void CommandBinding_DeleteFile(object sender, ExecutedRoutedEventArgs e)
        {
            try
            {
                Window parentWindow = Window.GetWindow(this);

                object obj = e.Parameter;
                if (obj == null)
                {
                    return;
                }

                if (obj.GetType() == typeof(VideoLocalVM))
                {
                    VideoLocalVM vid = obj as VideoLocalVM;

                    MessageBoxResult res = MessageBox.Show(string.Format("Are you sure you want to delete this file: {0}", vid.FullPath),
                                                           "Confirm", MessageBoxButton.YesNo, MessageBoxImage.Question);
                    if (res == MessageBoxResult.Yes)
                    {
                        string result = JMMServerVM.Instance.clientBinaryHTTP.DeleteVideoLocalAndFile(vid.VideoLocalID);
                        if (result.Length > 0)
                        {
                            MessageBox.Show(result, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                        else
                        {
                            RefreshUnrecognisedFiles();
                        }
                    }
                }
                if (obj.GetType() == typeof(MultipleVideos))
                {
                    MultipleVideos   mv  = obj as MultipleVideos;
                    MessageBoxResult res = MessageBox.Show(string.Format("Are you sure you want to delete the {0} selected files", mv.VideoLocalIDs.Count),
                                                           "Confirm", MessageBoxButton.YesNo, MessageBoxImage.Question);
                    if (res == MessageBoxResult.Yes)
                    {
                        foreach (int id in mv.VideoLocalIDs)
                        {
                            JMMServerVM.Instance.clientBinaryHTTP.DeleteVideoLocalAndFile(id);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
예제 #3
0
        private void CommandBinding_RestoreFile(object sender, ExecutedRoutedEventArgs e)
        {
            try
            {
                Window parentWindow = Window.GetWindow(this);

                object obj = e.Parameter;
                if (obj == null)
                {
                    return;
                }

                if (obj.GetType() == typeof(VideoLocalVM))
                {
                    VideoLocalVM vid = obj as VideoLocalVM;
                    EnableDisableControls(false);

                    string result = JMMServerVM.Instance.clientBinaryHTTP.SetIgnoreStatusOnFile(vid.VideoLocalID, false);
                    if (result.Length > 0)
                    {
                        MessageBox.Show(result, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                    else
                    {
                        RefreshIgnoredFiles();
                    }
                }
                if (obj.GetType() == typeof(MultipleVideos))
                {
                    MultipleVideos mv = obj as MultipleVideos;
                    foreach (int id in mv.VideoLocalIDs)
                    {
                        string result = JMMServerVM.Instance.clientBinaryHTTP.SetIgnoreStatusOnFile(id, false);
                        if (result.Length > 0)
                        {
                            MessageBox.Show(result, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                    }
                    RefreshIgnoredFiles();
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }

            EnableDisableControls(true);
        }
예제 #4
0
        private void DgVideos_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                ccDetail.Content         = null;
                ccDetailMultiple.Content = null;

                AnyVideosSelected      = dgVideos.SelectedItems.Count > 0;
                OneVideoSelected       = dgVideos.SelectedItems.Count == 1;
                MultipleVideosSelected = dgVideos.SelectedItems.Count > 1;

                MultipleTypeRange  = cboMultiType.SelectedIndex == 0;
                MultipleTypeSingle = cboMultiType.SelectedIndex == 1;



                // if only one video selected
                if (OneVideoSelected)
                {
                    VideoLocalVM vid = dgVideos.SelectedItem as VideoLocalVM;
                    ccDetail.Content = vid;
                }

                // if only one video selected
                if (MultipleVideosSelected)
                {
                    MultipleVideos mv = new MultipleVideos();
                    mv.SelectedCount = dgVideos.SelectedItems.Count;
                    mv.VideoLocalIDs = new List <int>();
                    mv.VideoLocals   = new List <VideoLocalVM>();

                    foreach (object obj in dgVideos.SelectedItems)
                    {
                        VideoLocalVM vid = obj as VideoLocalVM;
                        mv.VideoLocalIDs.Add(vid.VideoLocalID);
                        mv.VideoLocals.Add(vid);
                    }

                    ccDetailMultiple.Content = mv;
                }

                SetConfirmDetails();
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
예제 #5
0
        void lbVideos_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                ccDetail.Content         = null;
                ccDetailMultiple.Content = null;

                OneVideoSelected       = lbVideos.SelectedItems.Count == 1;
                MultipleVideosSelected = lbVideos.SelectedItems.Count > 1;

                // if only one video selected
                if (OneVideoSelected)
                {
                    VideoLocalVM vid = lbVideos.SelectedItem as VideoLocalVM;
                    ccDetail.Content = vid;
                }

                // if only one video selected
                if (MultipleVideosSelected)
                {
                    MultipleVideos mv = new MultipleVideos();
                    mv.SelectedCount = lbVideos.SelectedItems.Count;
                    mv.VideoLocalIDs = new List <int>();

                    foreach (object obj in lbVideos.SelectedItems)
                    {
                        VideoLocalVM vid = obj as VideoLocalVM;
                        mv.VideoLocalIDs.Add(vid.VideoLocalID);
                    }

                    ccDetailMultiple.Content = mv;
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
예제 #6
0
        private void CommandBinding_RescanFile(object sender, ExecutedRoutedEventArgs e)
        {
            try
            {
                Window parentWindow = Window.GetWindow(this);

                object obj = e.Parameter;
                if (obj == null)
                {
                    return;
                }

                if (obj.GetType() == typeof(VideoLocalVM))
                {
                    VideoLocalVM vid = obj as VideoLocalVM;
                    EnableDisableControls(false);

                    JMMServerVM.Instance.clientBinaryHTTP.RescanFile(vid.VideoLocalID);
                }
                if (obj.GetType() == typeof(MultipleVideos))
                {
                    MultipleVideos mv = obj as MultipleVideos;
                    foreach (int id in mv.VideoLocalIDs)
                    {
                        JMMServerVM.Instance.clientBinaryHTTP.RescanFile(id);
                    }
                }

                MessageBox.Show(Properties.Resources.MSG_INFO_AddedQueueCmds, "Done", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }

            EnableDisableControls(true);
        }
        private void DgVideos_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                ccDetail.Content = null;
                ccDetailMultiple.Content = null;

                AnyVideosSelected = dgVideos.SelectedItems.Count > 0;
                OneVideoSelected = dgVideos.SelectedItems.Count == 1;
                MultipleVideosSelected = dgVideos.SelectedItems.Count > 1;

                MultipleTypeRange = cboMultiType.SelectedIndex == 0;
                MultipleTypeSingle = cboMultiType.SelectedIndex == 1;

                // if only one video selected
                if (OneVideoSelected)
                {
                    VideoLocalVM vid = dgVideos.SelectedItem as VideoLocalVM;
                    ccDetail.Content = vid;
                }

                // if only one video selected
                if (MultipleVideosSelected)
                {
                    MultipleVideos mv = new MultipleVideos();
                    mv.SelectedCount = dgVideos.SelectedItems.Count;
                    mv.VideoLocalIDs = new List<int>();
                    mv.VideoLocals = new List<VideoLocalVM>();

                    foreach (object obj in dgVideos.SelectedItems)
                    {
                        VideoLocalVM vid = obj as VideoLocalVM;
                        mv.VideoLocalIDs.Add(vid.VideoLocalID);
                        mv.VideoLocals.Add(vid);
                    }

                    ccDetailMultiple.Content = mv;
                }

                SetConfirmDetails();
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
예제 #8
0
        private void CommandBinding_DeleteFile(object sender, ExecutedRoutedEventArgs e)
        {
            try
            {
                Window parentWindow = Window.GetWindow(this);

                object obj = e.Parameter;
                if (obj == null)
                {
                    return;
                }

                if (obj.GetType() == typeof(VideoLocalVM))
                {
                    VideoLocalVM vid = obj as VideoLocalVM;


                    AskDeleteFile dlg = new AskDeleteFile(string.Format(Properties.Resources.DeleteFile_Title, vid.FileName), Properties.Resources.Unrecognized_ConfirmDelete + "\r\n\r\n" + Properties.Resources.DeleteFile_Confirm, vid.Places);
                    dlg.Owner = Window.GetWindow(this);
                    bool?res = dlg.ShowDialog();
                    if (res.HasValue && res.Value)
                    {
                        EnableDisableControls(false);
                        string tresult = string.Empty;
                        this.Cursor = Cursors.Wait;
                        foreach (VideoLocal_PlaceVM lv in dlg.Selected)
                        {
                            string result = JMMServerVM.Instance.clientBinaryHTTP.DeleteVideoLocalPlaceAndFile(lv.VideoLocal_Place_ID);
                            if (result.Length > 0)
                            {
                                tresult += result + "\r\n";
                            }
                        }
                        if (!string.IsNullOrEmpty(tresult))
                        {
                            MessageBox.Show(tresult, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                        RefreshIgnoredFiles();
                    }
                }

                if (obj.GetType() == typeof(MultipleVideos))
                {
                    MultipleVideos mv  = obj as MultipleVideos;
                    AskDeleteFile  dlg = new AskDeleteFile(Properties.Resources.DeleteFile_Multiple, Properties.Resources.Unrecognized_DeleteSelected + "\r\n\r\n" + Properties.Resources.DeleteFile_Confirm, mv.VideoLocals.SelectMany(a => a.Places).ToList());
                    dlg.Owner = Window.GetWindow(this);
                    bool?res = dlg.ShowDialog();
                    if (res.HasValue && res.Value)
                    {
                        EnableDisableControls(false);
                        string tresult = string.Empty;
                        this.Cursor = Cursors.Wait;
                        foreach (VideoLocal_PlaceVM lv in dlg.Selected)
                        {
                            string result = JMMServerVM.Instance.clientBinaryHTTP.DeleteVideoLocalPlaceAndFile(lv.VideoLocal_Place_ID);
                            if (result.Length > 0)
                            {
                                tresult += result + "\r\n";
                            }
                        }
                        if (!string.IsNullOrEmpty(tresult))
                        {
                            MessageBox.Show(tresult, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                        RefreshIgnoredFiles();
                    }
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }

            EnableDisableControls(true);
        }
        void lbVideos_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                ccDetail.Content = null;
                ccDetailMultiple.Content = null;

                OneVideoSelected = lbVideos.SelectedItems.Count == 1;
                MultipleVideosSelected = lbVideos.SelectedItems.Count > 1;

                // if only one video selected
                if (OneVideoSelected)
                {
                    VideoLocalVM vid = lbVideos.SelectedItem as VideoLocalVM;
                    ccDetail.Content = vid;
                }

                // if only one video selected
                if (MultipleVideosSelected)
                {
                    MultipleVideos mv = new MultipleVideos();
                    mv.SelectedCount = lbVideos.SelectedItems.Count;
                    mv.VideoLocalIDs = new List<int>();

                    foreach (object obj in lbVideos.SelectedItems)
                    {
                        VideoLocalVM vid = obj as VideoLocalVM;
                        mv.VideoLocalIDs.Add(vid.VideoLocalID);
                    }

                    ccDetailMultiple.Content = mv;
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }