public async Task Update_Color(Color _color)
        {
            int Index = ColorTypeSelector.SelectedIndex;

            switch (Index)
            {
            case 0:
                _Base = _color;
                break;

            case 1:
                _HighContrast = _color;
                break;

            case 2:
                _Lowlight = _color;
                break;

            case 3:
                _Highlight = _color;
                break;

            case 4:
                _Muted = _color;
                break;

            case 5:
                _Secondary = _color;
                break;
            }
            PreviewControl.Update_ColorOnPreview(Index, await Generate_BandTheme());
        }
        private async void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int it = ((ListBox)sender).SelectedIndex;

            PreviewControl.Change_Item(it);
            Color c = await Get_Color();

            _R.Text = c.R.ToString();
            _G.Text = c.G.ToString();
            _B.Text = c.B.ToString();

            try
            {
                _RSlider.Value = double.Parse(c.R.ToString());
                _GSlider.Value = double.Parse(c.G.ToString());
                _BSlider.Value = double.Parse(c.B.ToString());
            }
            catch (Exception ex)
            {
                MessageDialog msg = new MessageDialog(ex.Message.ToString(), ex.HResult.ToString());
                await msg.ShowAsync();

                System.Diagnostics.Debug.WriteLine(ex.Message);
            }

            Update_Hex(c);

            PreviewControl.Update_ColorOnPreview(-1, await Generate_BandTheme());
        }
        public async Task Load_Theme(BandTheme theme)
        {
            Base.Background         = new SolidColorBrush(_Theme.Base.ToColor());
            HighContrast.Background = new SolidColorBrush(_Theme.HighContrast.ToColor());
            Lowlight.Background     = new SolidColorBrush(_Theme.Lowlight.ToColor());
            Highlight.Background    = new SolidColorBrush(_Theme.Highlight.ToColor());
            Muted.Background        = new SolidColorBrush(_Theme.Muted.ToColor());
            Secondary.Background    = new SolidColorBrush(_Theme.SecondaryText.ToColor());

            _Base         = _Theme.Base.ToColor();
            _HighContrast = _Theme.HighContrast.ToColor();
            _Lowlight     = _Theme.Lowlight.ToColor();
            _Highlight    = _Theme.Highlight.ToColor();
            _Muted        = _Theme.Muted.ToColor();
            _Secondary    = _Theme.SecondaryText.ToColor();

            PreviewControl.Update_ColorOnPreview(-1, await Generate_BandTheme());

            if (ColorTypeSelector.SelectedIndex == -1)
            {
                ColorTypeSelector.SelectedIndex = 0;
            }
            else
            {
                Update_ColorSelectors(ColorTypeSelector.SelectedIndex);
            }
        }
예제 #4
0
        internal void Cleanup()
        {
            var tnp = (Nodes.TreeNodeProvider)FindResource("treeNodeProvider");

            tnp.Song = null;
            PreviewControl.Cleanup();
        }
예제 #5
0
        private void Previous()
        {
            string filePath = _fileCollection.GetPreviousPath();

            PreviewControl.ReplaceContent(filePath);
            this.Title = filePath;
        }
예제 #6
0
        void QuotationSmartRepeater_ActiveListItemChanged(object o, EventArgs a)
        {
            if (Program.ActiveProjectShell.PrimaryMainForm.GetSelectedQuotations().Count == 0)
            {
                return;
            }

            KnowledgeItem activeQuotation = Program.ActiveProjectShell.PrimaryMainForm.GetSelectedQuotations().FirstOrDefault();

            if (activeQuotation.EntityLinks == null)
            {
                return;
            }
            if (activeQuotation.EntityLinks.Where(e => e.Indication == EntityLink.PdfKnowledgeItemIndication).Count() == 0)
            {
                return;
            }

            Annotation annotation = activeQuotation.EntityLinks.Where(e => e.Indication == EntityLink.PdfKnowledgeItemIndication).FirstOrDefault().Target as Annotation;

            PreviewControl previewControl = PreviewMethods.GetPreviewControl();

            if (previewControl == null)
            {
                return;
            }

            SwissAcademic.Citavi.Controls.Wpf.PdfViewControl pdfViewControl = previewControl.GetPdfViewControl();
            if (pdfViewControl == null)
            {
                return;
            }

            pdfViewControl.GoToAnnotation(annotation);
        }
예제 #7
0
 private void OnPreviewControlMouseLeave(object sender, MouseEventArgs e)
 {
     if (!PreviewControl.StaysOpen)
     {
         PreviewControl.TransitionToState(PreviewControl.State.Condensed);
     }
 }
예제 #8
0
        private async void BackgroundList_ItemClick(Object sender, ItemClickEventArgs e)
        {
            try
            {
                var foreground = await PreviewControl.CapturePhotoAsync(ApplicationData.Current.TemporaryFolder, Guid.NewGuid().ToString());

                var blobService = new Services.BlobService.BlobService(accountName, blobKey, "launch", "face");
                await blobService.UploadAsync(foreground);

                var payload = new FaceSwapDetails()
                {
                    key = swapKey, envfilename = e.ClickedItem as string, facefilename = foreground.Name
                };
                new Services.FaceSwapService().PostAsync(payload);

                var contentDialog = new ContentDialog
                {
                    Title             = "Message",
                    Content           = "Done",
                    PrimaryButtonText = "Ok"
                };
                await contentDialog.ShowAsync();
            }
            finally
            {
                // TODO
            }
        }
예제 #9
0
        private void TryShowPreviewBubbles()
        {
            nodeWasClicked = false;

            // Always set old ZIndex to the last value, even if mouse is not over the node.
            oldZIndex = NodeViewModel.StaticZIndex;

            // There is no need run further.
            if (IsPreviewDisabled())
            {
                return;
            }

            if (PreviewControl.IsInTransition) // In transition state, come back later.
            {
                return;
            }

            if (PreviewControl.IsHidden)
            {
                if (!previewControl.IsDataBound)
                {
                    PreviewControl.BindToDataSource();
                }

                PreviewControl.TransitionToState(PreviewControl.State.Condensed);
            }

            Dispatcher.DelayInvoke(previewDelay, BringToFront);
        }
예제 #10
0
 public static ICitaviEntity GetSelectedCitaviEntity(this PreviewControl previewControl)
 {
     return(previewControl?
            .GetSelectedAdornmentCanvas()?
            .FirstOrDefault()?
            .CitaviEntity);
 }
 private void tvViews_AfterSelect(object sender, TreeViewEventArgs e)
 {
     //IL_0026: Unknown result type (might be due to invalid IL or missing references)
     //IL_0027: Unknown result type (might be due to invalid IL or missing references)
     //IL_002a: Unknown result type (might be due to invalid IL or missing references)
     //IL_0037: Unknown result type (might be due to invalid IL or missing references)
     //IL_003d: Unknown result type (might be due to invalid IL or missing references)
     //IL_0042: Unknown result type (might be due to invalid IL or missing references)
     //IL_0047: Expected O, but got Unknown
     //IL_004e: Unknown result type (might be due to invalid IL or missing references)
     //IL_0053: Unknown result type (might be due to invalid IL or missing references)
     try
     {
         DBViewItem dBViewItem = e.Node.Tag as DBViewItem;
         if (dBViewItem != null)
         {
             PreviewControl val = this._elementHostWPF.Child as PreviewControl;
             if ((int)val != 0)
             {
                 val.Dispose();
             }
             this._elementHostWPF.Child = (UIElement) new PreviewControl(this.m_dbDocument, dBViewItem.Id);
             this.m_currentDBViewId     = dBViewItem.Id;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, UtilEnvMsg.Preview);
     }
 }
예제 #12
0
    public void UpdateToStringTab()
    {
        PreviewControl control = new PreviewControl();

        control.Update("to string result");
        Assert.AreEqual("to string result", control.textBoxToString.Text);
    }
예제 #13
0
 public static PdfViewControl GetPdfViewControl(this PreviewControl previewControl)
 {
     return(previewControl
            .GetType()
            .GetProperty("PdfViewControl", BindingFlags.Instance | BindingFlags.NonPublic)?
            .GetValue(previewControl) as PdfViewControl);
 }
예제 #14
0
 /// <summary>
 /// 设计器支持所需的方法 - 不要
 /// 使用代码编辑器修改此方法的内容。
 /// </summary>
 private void InitializeComponent()
 {
     previewControlFR = new PreviewControl();
     SuspendLayout();
     //
     // previewControlFR
     //
     previewControlFR.BackColor      = System.Drawing.SystemColors.AppWorkspace;
     previewControlFR.Dock           = System.Windows.Forms.DockStyle.Fill;
     previewControlFR.FastScrolling  = true;
     previewControlFR.Font           = new System.Drawing.Font("宋体", 9F);
     previewControlFR.Location       = new System.Drawing.Point(0, 0);
     previewControlFR.Name           = "previewControlFR";
     previewControlFR.PageOffset     = new System.Drawing.Point(10, 10);
     previewControlFR.Size           = new System.Drawing.Size(550, 435);
     previewControlFR.TabIndex       = 0;
     previewControlFR.ToolbarVisible = false;
     previewControlFR.UIStyle        = FastReport.Utils.UIStyle.Office2007Black;
     //
     // printlabel
     //
     AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
     AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     Controls.Add(this.previewControlFR);
     Margin = new System.Windows.Forms.Padding(0);
     Name   = "printlabel";
     Size   = new System.Drawing.Size(550, 435);
     Load  += new System.EventHandler(this.Form1_Load);
     ResumeLayout(false);
 }
예제 #15
0
 private void Preview_Control(a.Document doc, a.ElementId elementId)
 {
     //IList<a.ElementId> viewexport = new List<a.ElementId>();
     //viewexport.Add(elementId);
     //ImageExportOptions options = new ImageExportOptions();
     //options.ShadowViewsFileType = options.HLRandWFViewsFileType = ImageFileType.PNG;
     //options.ZoomType = ZoomFitType.Zoom;
     //options.FitDirection = FitDirectionType.Horizontal;
     //options.ImageResolution = ImageResolution.DPI_150;
     //string folder = SettingAddview.Instance.GetFolderPath();
     //string fileBase = Path.GetFileNameWithoutExtension(Path.GetTempFileName());
     //options.FilePath = Path.Combine(folder, fileBase);
     //options.ExportRange = ExportRange.SetOfViews;
     //options.ShouldCreateWebSite = false;
     //options.SetViewsAndSheets(viewexport);
     //doc.ExportImage(options);
     //string[] files = Directory.GetFiles(folder, fileBase + "*.png");
     //foreach (string file in files)
     //{
     //    Image image = Image.FromFile(file);
     //    pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
     //    pictureBox1.Image = image;
     //}
     a.View view = doc.GetElement(elementId) as a.View;
     pc?.Dispose();
     if (view.ViewType != ViewType.Schedule)
     {
         pc = new PreviewControl(doc, elementId);
         elementHost1.Child = pc;
     }
 }
예제 #16
0
        private void cbViews_SelIdxChanged(object sender, EventArgs e)
        {
            System.Windows.Forms.ComboBox cb = sender as System.Windows.Forms.ComboBox;
            if (cb == null)
            {
                return;
            }

            DBViewItem dbItem = cb.SelectedItem as DBViewItem;

            if (dbItem == null)
            {
                return;
            }

            //if (_currentDBViewId == null)
            //    return;

            //RView currentView = _dbDocument.get_Element(_currentDBViewId) as RView;
            //if(currentView == null)
            //    return;

            //if (dbItem.UniqueId.ToLower().CompareTo(currentView.UniqueId.ToLower()) != 0)
            //    return;

            PreviewControl vc = _elementHostWPF.Child as PreviewControl;

            if (vc != null)
            {
                vc.Dispose();
            }
            _elementHostWPF.Child = new PreviewControl(_dbDocument, dbItem.Id);
            _currentDBViewId      = dbItem.Id;
        }
예제 #17
0
 private void OnPreviewControlMouseEnter(object sender, MouseEventArgs e)
 {
     if (PreviewControl.IsCondensed)
     {
         PreviewControl.TransitionToState(PreviewControl.State.Expanded);
     }
 }
예제 #18
0
        public void ChangeYOffset()
        {
            PreviewControl preview = new PreviewControl();
            preview.OffsetY = 3.0;

            Assert.AreEqual(3.0, (double)preview.GetValue(Canvas.TopProperty), "OffsetY should have set the canvas's Top property.");
        }
예제 #19
0
        public void ChangeXOffset()
        {
            PreviewControl preview = new PreviewControl();
            preview.OffsetX = 2.0;

            Assert.AreEqual(2.0, (double)preview.GetValue(Canvas.LeftProperty), "OffsetX should have set the canvas's Left property.");
        }
예제 #20
0
 internal static PdfViewControl GetPdfViewControl(this PreviewControl previewControl)
 {
     return(previewControl?
            .GetType()
            .GetProperty("PdfViewControl", Flags, null, typeof(PdfViewControl), new Type[0], null)?
            .GetValue(previewControl, Flags, null, null, null) as PdfViewControl);
 }
예제 #21
0
        public static PreviewControl GetPreviewControl()
        {
            MainForm       previewMainForm = null;
            List <Form>    forms           = new List <Form>();
            PreviewControl previewControl  = null;

            foreach (Form form in Application.OpenForms)
            {
                if (!form.Visible)
                {
                    continue;
                }
                MainForm mainForm = form as MainForm;
                if (mainForm == null)
                {
                    continue;
                }
                if (!mainForm.IsPreviewFullScreenForm)
                {
                    continue;
                }
                previewMainForm = mainForm;
                break;
            }

            if (previewMainForm == null)
            {
                previewMainForm = Program.ActiveProjectShell.PrimaryMainForm;
            }

            previewControl = previewMainForm.PreviewControl;

            return(previewControl);
        }
 private void btRefresh_Click(object sender, RoutedEventArgs e)
 {
     Report.Render();
     PreviewControl.SaveConfig();
     PreviewControl.Refresh();
     PreviewControl.LoadConfig();
 }
예제 #23
0
        public void ChangeYOffset()
        {
            PreviewControl preview = new PreviewControl();

            preview.OffsetY = 3.0;

            Assert.AreEqual(3.0, (double)preview.GetValue(Canvas.TopProperty), "OffsetY should have set the canvas's Top property.");
        }
예제 #24
0
        public void ChangeXOffset()
        {
            PreviewControl preview = new PreviewControl();

            preview.OffsetX = 2.0;

            Assert.AreEqual(2.0, (double)preview.GetValue(Canvas.LeftProperty), "OffsetX should have set the canvas's Left property.");
        }
 private void cbPrint_CheckedUnchecked(object sender, EventArgs e)
 {
     if (!Lock)
     {
         StiOptions.Viewer.Elements.ShowReportPrintButton = cbPrint.IsChecked;
         PreviewControl.UpdateControlsState();
     }
 }
 private void cbStatusBar_CheckedUnchecked(object sender, EventArgs e)
 {
     if (!Lock)
     {
         StiOptions.Viewer.Elements.ShowStatusBar = cbStatusBar.IsChecked;
         PreviewControl.UpdateControlsState();
     }
 }
 private void cbBookmarks_CheckedUnChecked(object sender, EventArgs e)
 {
     if (!Lock)
     {
         PreviewControl.IsBookmarksActivated = cbBookmarks.IsChecked;
         PreviewControl.UpdateControlsState();
     }
 }
 private void cbZoomPageWidth_CheckedUnchecked(object sender, EventArgs e)
 {
     if (!Lock)
     {
         StiOptions.Viewer.Elements.ShowZoomPageWidthButton = cbZoomPageWidth.IsChecked;
         PreviewControl.UpdateControlsState();
     }
 }
 private void cbFullScreen_CheckedUnchecked(object sender, EventArgs e)
 {
     if (!Lock)
     {
         StiOptions.Viewer.Elements.ShowFullScreenButton = cbFullScreen.IsChecked;
         PreviewControl.UpdateControlsState();
     }
 }
 private void cbToolFind_CheckedUnchecked(object sender, EventArgs e)
 {
     if (!Lock)
     {
         PreviewControl.IsToolFindActivated = cbToolFind.IsChecked;
         PreviewControl.UpdateControlsState();
     }
 }
 private void cbToolEditor_CheckedUnchecked(object sender, EventArgs e)
 {
     if (!Lock)
     {
         StiOptions.Viewer.Elements.ShowToolEditorButton = cbToolEditor.IsChecked;
         PreviewControl.UpdateControlsState();
     }
 }
 private void cbBookmarksButton_CheckedUnchecked(object sender, EventArgs e)
 {
     if (!Lock)
     {
         StiOptions.Viewer.Elements.ShowBookmarksPanel = cbBookmarksButton.IsChecked;
         PreviewControl.UpdateControlsState();
     }
 }
예제 #33
0
 public void InstantiatePreviewControl()
 {
     PreviewControl preview = new PreviewControl();
     Assert.IsNotNull(preview, "PreviewControl construction should succeed.");
 }
예제 #34
0
 public void BindToValidGridSplitter()
 {
     Grid g = GridSplitterTest.CreateGrid(2, 2, 100, 100);
     GridSplitter splitter = GridSplitterTest.CreateGridSplitterThroughCode(1, 1, 1, null, null, 10.0, null, HorizontalAlignment.Left, new SolidColorBrush(Colors.Cyan), true);
     g.Children.Add(splitter);
     PreviewControl preview = new PreviewControl();
     this.CreateAsyncTest(g,
         () => preview.Bind(splitter),
         delegate
         {
             Assert.AreEqual(50.0, preview.Height, "Height should be half the height of the grid");
             Assert.AreEqual(10.0, preview.Width, "Width should be the width of the GridSplitter");
             Assert.AreEqual(50.0, (double)preview.GetValue(Canvas.LeftProperty), "Left position should be on left edge of the second column");
             Assert.AreEqual(50.0, (double)preview.GetValue(Canvas.TopProperty), "Top position should be on top edge of the second row");
         });
 }