Ejemplo n.º 1
0
        private void uxRefresh_Click(object sender, EventArgs e)
        {
            LibraryData.UpdateFilesList();
            uxImagesView.DataSource = LibraryData.GetAllItems().ToList();

            treeBuilder.Load();
            uxWhere.Properties.DataSource = treeTable.DefaultView;

            Filter();
            needsUpdate = false;
            //uxRefresh.Enabled = false;

            timerCheckForUpdates.Enabled = true;
        }
Ejemplo n.º 2
0
        private void Filter()
        {
            uxWhat.Properties.Buttons[(int)WhatButtons.Search].Enabled = false;

            Regex regEx = new Regex(uxWhat.Tag == null ? uxWhat.Text : "", RegexOptions.IgnoreCase);

            dsTree.TreeRow row  = treeTable.FindByID((int)uxWhere.EditValue);
            var            list = LibraryData.GetAllItems();
            int            n    = list.Count();

            if (row.ParentID == -1)
            {
                list = list.Where(item =>
                                  regEx.IsMatch(item.Keywords)
                                  );
            }
            else if (row.Data is LibraryFile)
            {
                LibraryFile file = row.Data as LibraryFile;
                list = list.Where(item =>
                                  item.File.Group.Name == file.Group.Name &&
                                  item.File.Name == file.Name &&
                                  regEx.IsMatch(item.Keywords)
                                  );
            }
            else
            {
                LibraryGroup group = row.Data as LibraryGroup;
                if (group != null)
                {
                    list = list.Where(item =>
                                      item.File.Group.FullPath == group.FullPath &&
                                      regEx.IsMatch(item.Keywords)
                                      );
                }
                else
                {
                    list = Enumerable.Empty <IFileItem>();
                }
            }

            uxImagesView.DataSource = list.ToList();
        }
Ejemplo n.º 3
0
        protected void AddSelectedShapes(IFile libraryFile)
        {
            PPT.Application    ppt = null;
            PPT.Presentation   pr  = null;
            PPT.DocumentWindow aw  = null;
            PPT.Selection      sel = null;

            try
            {
                timerCheckForUpdates.Enabled = false;

                ppt = new PPT.Application();
                pr  = ppt.ActivePresentation;

                if (pr.FullName == libraryFile.FullPath)
                {
                    MessageBox.Show("You can't add slides to the same presentation");
                    return;
                }

                aw  = ppt.ActiveWindow;
                sel = aw.Selection;
                List <PPT.Shape> shapesToAdd = new List <PPT.Shape>();

                if (sel.Type == PPT.PpSelectionType.ppSelectionShapes)
                {
                    foreach (PPT.Shape slide in sel.ShapeRange)
                    {
                        shapesToAdd.Add(slide);
                    }
                }
                else
                {
                    shapesToAdd.Add(aw.View.Slide as PPT.Shape);
                }

                if (shapesToAdd.Count > 0)
                {
                    libraryFile.AppendShapes(shapesToAdd);
                    uxImagesView.DataSource = LibraryData.GetAllItems().ToList();
                    Filter();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sel.ReleaseCOM();
                sel = null;

                pr.ReleaseCOM();
                pr = null;

                aw.ReleaseCOM();
                aw = null;

                ppt.ReleaseCOM();
                ppt = null;

                timerCheckForUpdates.Enabled = !needsUpdate;
            }
        }
Ejemplo n.º 4
0
 private void ReloadDataSource()
 {
     uxImagesView.DataSource = LibraryData.GetAllItems().ToList();
     Filter();
 }