예제 #1
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            switch (keyData)
            {
            case Keys.Up:
                gridView1.FocusedRowHandle = gridView1.FocusedRowHandle == 0 ? 0 : gridView1.FocusedRowHandle - 1;
                if (gridView1.FocusedRowHandle < 0)
                {
                    return(true);
                }
                focusedfolder = (VideoProject)gridView1.GetRow(gridView1.FocusedRowHandle);
                return(true);

            case Keys.Down:
                gridView1.FocusedRowHandle = gridView1.FocusedRowHandle == gridView1.RowCount - 1 ? gridView1.RowCount - 1 : gridView1.FocusedRowHandle + 1;
                if (gridView1.FocusedRowHandle < 0)
                {
                    return(true);
                }
                focusedfolder = (VideoProject)gridView1.GetRow(gridView1.FocusedRowHandle);
                return(true);

            default:
                break;
            }
            return(base.ProcessCmdKey(ref msg, keyData));
        }
예제 #2
0
        /// <summary>
        /// 扫描文件夹
        /// </summary>
        /// <param name="focusedfolder"></param>
        /// <returns></returns>
        public static bool ScanFolder(VideoProject focusedfolder)
        {
            string  posturl    = Url + "/scan/video/project/" + focusedfolder.Id.ToString();
            string  conditions = "project_name=" + focusedfolder.Name;
            JObject obj        = WebClinetHepler.Post_New(posturl);

            return(obj != null);
        }
예제 #3
0
        public static bool AddFolder(VideoProject folder)
        {
            string  posturl = Url + "/video/project";
            string  json    = JsonHelper.SerializeDataContractJson(folder);
            JObject obj     = WebClinetHepler.Post_New(posturl, json);

            return(obj != null);
        }
예제 #4
0
        /// <summary>
        /// 焦点改变
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            int rowIndex = gridView1.FocusedRowHandle;

            if (rowIndex < 0 || rowIndex > Videos.Count - 1)
            {
                return;
            }
            focusedfolder = (VideoProject)gridView1.GetRow(rowIndex);
        }
예제 #5
0
        /// <summary>
        /// 将填入的信息转化成类,并加入文件夹集合
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            string name       = textBox_name.Text == string.Empty ? string.Empty : textBox_name.Text.Trim();
            string place      = textBox_place.Text == string.Empty ? string.Empty : textBox_place.Text.Trim();;
            int    scenes     = comboBox_scenes.SelectedIndex;
            string start_time = dateTimePicker_start.Value.ToString("yyyy-MM-dd");
            string end_time   = dateTimePicker_end.Value.ToString("yyyy-MM-dd");
            string url        = textBox_url.Text == string.Empty ? string.Empty : textBox_url.Text.Trim();
            string size       = textBox_size.Text == string.Empty ? string.Empty : textBox_size.Text.Trim();
            string replicator = textBox_replicator.Text == string.Empty ? string.Empty : textBox_replicator.Text.Trim();
            string recorder   = textBox_recorder.Text == string.Empty ? string.Empty : textBox_recorder.Text.Trim();
            string note       = textBox_note.Text == string.Empty ? string.Empty : textBox_note.Text.Trim();
            int    count      = 0;

            try
            {
                count = int.Parse(textBox_count.Text);
                url   = StringToString(url);
            }
            catch (Exception)
            {
                MessageBox.Show("输入的数量格式有误");
                return;
            }


            VideoProject video_project = new VideoProject
            {
                Name       = name,
                Place      = place,
                Scenes     = scenes,
                StartDate  = start_time,
                VideoCount = count,
                EndDate    = end_time,
                Uri        = url,
                Size       = size,
                Replicator = replicator,
                Recorder   = recorder,
                Note       = note,
            };

            if (!GetDatas.VideoData.AddFolder(video_project))
            {
                MessageBox.Show("上传失败");
                return;
            }
            else
            {
                MessageBox.Show("上传成功");
            }
            OnAdd();
            this.Close();
            Program.log.Error("上传文件夹", new Exception($"{video_project.ToString()}"));
        }
예제 #6
0
        public MainPage()
        {
            this.InitializeComponent();

            Sequensor.Controller.Create();
            Sequensor.Controller.AddItem += async(sender, item) =>
            {
                if (m_need_init && item is Sequence.Render.SequenceRenderObject)
                {
                    var w = (item as Sequence.Render.SequenceRenderObject).Width;
                    var h = (item as Sequence.Render.SequenceRenderObject).Height;

                    m_need_init = false;
                    await VideoProject.GetInstance().SetSettings((int)w, (int)h, MediaCore.Types.FPS.FPS10);

                    w = VideoProject.GetInstance().Width;
                    h = VideoProject.GetInstance().Heigth;

                    W2D.Width  = w;
                    W2D.Height = h;

                    canvas.Width  = w;
                    canvas.Height = h;
                }

                var render = item as Sequence.Render.SequenceRenderObject;

                if (render != null)
                {
                    var rect = new TransformationBox()
                    {
                        Width           = render.Width,
                        Height          = render.Height,
                        Background      = new SolidColorBrush(Colors.Transparent),
                        BorderBrush     = new SolidColorBrush(Colors.Red),
                        BorderThickness = new Thickness(2),
                        Render          = render
                    };

                    rect.CompositeTransformChange += (s) => {
                        W2D.Invalidate();
                    };

                    canvas.Children.Add(rect);
                }
            };

            Sequensor.Controller.OnDraw += () =>
            {
                W2D.Invalidate();
            };
        }
예제 #7
0
        /// <summary>
        /// 修改文件夹信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ModifyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (gridView1.FocusedRowHandle < 0)
            {
                return;
            }
            focusedfolder = (VideoProject)gridView1.GetRow(gridView1.FocusedRowHandle);
            UpdateContent update = new UpdateContent(focusedfolder);

            update.MyEvent += new UpdateContent.MyDelegate(GetInformationShow);
            update.Show();
            Program.log.Info($"更改{focusedfolder.Name}的信息");
        }
예제 #8
0
 /// <summary>
 /// 双击打开文件夹
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void gridControl1_DoubleClick(object sender, EventArgs e)
 {
     if (gridView1.FocusedRowHandle < 0)
     {
         return;
     }
     focusedfolder = (VideoProject)gridView1.GetRow(gridView1.FocusedRowHandle);
     if (focusedfolder == null)
     {
         return;
     }
     if (hInfo.InRowCell)
     {
         InformationDisplay information = new InformationDisplay(focusedfolder);
         information.MyEvent += new InformationDisplay.MyDelegate(GetInformationShow);
         information.Show();
         Program.log.Info($"打开{focusedfolder.Name}");
     }
 }
예제 #9
0
        public async Task GetRenderObjects(int frame)
        {
            var fps  = (int)VideoProject.GetInstance().FPS;
            var time = TimeSpan.FromMilliseconds(frame * fps);

            List <RenderObjectBase[]> source = new List <RenderObjectBase[]>();

            foreach (var sequence in m_sequences)
            {
                var items = sequence.Items.Where(x =>
                                                 x is SequenceRenderObject &&
                                                 time >= x.StartTime &&
                                                 time < x.StartTime + x.Duration
                                                 )
                            .Select(x => x as SequenceRenderObject)
                            .ToList();

                if (items.Any())
                {
                    List <RenderObjectBase> renders = new List <RenderObjectBase>();
                    foreach (var item in items)
                    {
                        renders.Add(new RenderObjectBase
                        {
                            Source   = await item.GetRenderData(time),
                            Position = new Vector2((float)item.Left, (float)item.Top),
                            Scale    = item.Scale
                        });
                    }
                    source.Add(renders.ToArray());
                }
            }

            lock (m_cache_frame)
            {
                m_cache_frame = source.ToArray();
            }
        }
예제 #10
0
        public SequenceControllerBase()
        {
            m_project = VideoProject.GetInstance();

            m_sequences = new ObservableCollection <SequenceBase>();
            m_names     = new ObservableCollection <string>();

            m_animator = new Storyboard();

            DoubleAnimation da = new DoubleAnimation();

            da.From     = 0;
            da.To       = 600;
            da.Duration = new Duration(TimeSpan.FromSeconds(20));
            da.EnableDependentAnimation = true;
            m_animator.Children.Add(da);
            Storyboard.SetTargetProperty(m_animator, "Value");

            m_project.SettingsChanged += (project) =>
            {
                // Обновление настроек
                int frames = 20000 / (int)project.FPS;
                int mills  = frames * (int)project.FPS;

                m_animator.Children.Clear();
                m_slider.Maximum = frames;

                var animation = new DoubleAnimation();

                animation.From = 0;
                animation.To   = frames;

                animation.Duration = new Duration(TimeSpan.FromMilliseconds(mills));
                animation.EnableDependentAnimation = true;

                m_animator.Children.Add(da);
            };
        }
예제 #11
0
 public UpdateContent(VideoProject project)
 {
     InitializeComponent();
     videoProject   = project;
     oldinformation = JsonConvert.SerializeObject(project);
 }
예제 #12
0
 public InformationDisplay(VideoProject focusedfolder)
 {
     InitializeComponent();
     project = focusedfolder;
 }