Ejemplo n.º 1
0
        private void SetActiveView(string view, DateTime?period)
        {
            if (_childVM != null && _childVM.Count > 0)
            {
                GspBaseViewModel selectedView = null;
                if (view.Length > 0)
                {
                    if (view == Constants.VIEW_WORKSCHEDULE)
                    {
                        selectedView = _childVM.SingleOrDefault(x => x.ToString().EndsWith(view + "Model"));
                    }
                    else
                    {
                        selectedView = _childVM.SingleOrDefault(x => x.ToString().Contains(view));
                    }
                }
                SelectedView = selectedView ?? _childVM[0];

                if (period.HasValue && SelectedView != null && SelectedView.GetType() == typeof(WorkScheduleViewModel))
                {
                    var workScheduleView = (WorkScheduleViewModel)SelectedView;
                    ContextService.Current.CommonDataContextService.StartDate = period.Value;
                    workScheduleView.LoadOnActivate = true;
                }
            }
        }
Ejemplo n.º 2
0
 public void populateFromClick(NodeClick click)
 {
     Clear();
     setSelected(click);
     refreshSelectedTree();
     SelectedView.setSelectedObjects(selected.ToList());
 }
Ejemplo n.º 3
0
        private void HandleLoadFromString(object sender, EventArgs e)
        {
            if (!CefCommandLine.Global.HasSwitch("disable-site-isolation-trials"))
            {
                // info:
                // https://magpcss.org/ceforum/viewtopic.php?f=6&t=17176&p=43706
                // https://bitbucket.org/chromiumembedded/cef/issues/2586
                MessageBox.Show("This test only works with --disable-site-isolation-trials.");
            }

            var view = SelectedView as CustomWebView;

            if (view is null)
            {
                return;
            }

            Guid sourceKey = Guid.NewGuid();

            view.AddSource(sourceKey, new StringSource("Hello, world!", "text/html"));
            var request = new CefRequest();

            request.Url = "http://example.com";
            request.SetReferrer("https://www.google.com/", CefReferrerPolicy.NeverClearReferrer);
            request.SetHeaderByName("CefNet-Source", sourceKey.ToString(), false);             // see CustomWebViewGlue.GetResourceHandler()
            SelectedView?.GetMainFrame().LoadRequest(request);
        }
 public void DrawSelector(View content, Canvas canvas, float openPercent)
 {
     if (!SelectorEnabled)
     {
         return;
     }
     if (_selectorDrawable != null && SelectedView != null)
     {
         var tag = (string)SelectedView.GetTag(Resource.Id.selected_view);
         if (tag.Equals(Tag + "SelectedView"))
         {
             canvas.Save();
             int left, right;
             var offset = (int)(SelectorBitmap.Width * openPercent);
             if (Mode == MenuMode.Left)
             {
                 right = content.Left;
                 left  = right - offset;
                 canvas.ClipRect(left, 0, right, Height);
                 canvas.DrawBitmap(SelectorBitmap, left, SelectorTop, null);
             }
             else if (Mode == MenuMode.Right)
             {
                 left  = content.Right;
                 right = left + offset;
                 canvas.ClipRect(left, 0, right, Height);
                 canvas.DrawBitmap(SelectorBitmap, right - SelectorBitmap.Width, SelectorTop, null);
             }
             canvas.Restore();
         }
     }
 }
Ejemplo n.º 5
0
        public void SetSelectedView(SelectedView selectedView)
        {
            var index = (int)selectedView;

            if (index != tabButtons.CheckedIndex)
            {
                tabButtons.CheckedIndex = (int)selectedView;
            }
        }
Ejemplo n.º 6
0
        public NavigationPartialViewModel Build(SelectedView selectedView)
        {
            var viewModel = new NavigationPartialViewModel
                                {
                                    Lakes = this.lakeRepository.GetAll().ToDtoList(),
                                    SelectedView = selectedView
                                };

            return viewModel;
        }
        private void _backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            string sqlScript  = "";
            string dropScript = "";

            StringBuilder    resultScript = new StringBuilder(string.Empty);
            StringCollection coll         = null;
            ScriptingOptions options      = new ScriptingOptions();

            IsLoading = true;


            //First script the DROP
            options.ScriptDrops        = true;
            options.IncludeHeaders     = true;
            options.IncludeIfNotExists = true;
            coll = SelectedView.Script(options);

            resultScript = new StringBuilder(string.Empty);

            foreach (string str in coll)
            {
                resultScript.Append(str);
                resultScript.Append(Environment.NewLine);
            }

            dropScript  = resultScript.ToString();
            dropScript += "GO";

            //Script the CREATE statement
            resultScript = new StringBuilder(string.Empty);

            coll = SelectedView.Script();

            foreach (string str in coll)
            {
                string tmpString = str;
                tmpString = tmpString.Replace("SET ANSI_NULLS ON", string.Empty);
                tmpString = tmpString.Replace("SET QUOTED_IDENTIFIER ON", string.Empty);

                resultScript.Append(tmpString);
                resultScript.Append(Environment.NewLine);
            }

            sqlScript += dropScript;
            sqlScript += resultScript.ToString();
            sqlScript += "GO";
            sqlScript += Environment.NewLine;
            sqlScript += Environment.NewLine;


            e.Result = sqlScript;
        }
Ejemplo n.º 8
0
 public void MonthList_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (MonthList.SelectedIndex < 0 || !AllowToSave)
     {
         return;
     }
     SlideInfo.LoadData(CalendarData.Months[MonthList.SelectedIndex]);
     Splash(true);
     SelectedView.ChangeMonth(CalendarData.Months[MonthList.SelectedIndex].Date);
     Splash(false);
     CalendarSettings.SelectedMonth = CalendarData.Months[MonthList.SelectedIndex].Date;
 }
Ejemplo n.º 9
0
 private async void HandleCaptureScreenshot(object sender, EventArgs e)
 {
     using (var dlg = new SaveFileDialog())
     {
         dlg.Filter = "Image (*.png)|*.png";
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             using (var f = File.Open(dlg.FileName, FileMode.Create, FileAccess.Write))
             {
                 await SelectedView.CaptureScreenshotAsync(null, f, CancellationToken.None);
             }
         }
     }
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Clean-up!
 /// </summary>
 protected override void OnDispose()
 {
     //Clear the flyouts
     Flyouts.Clear();
     //Dispose the login view
     if (null != _loginView)
     {
         _loginView.UserLoggedIn -= LoginViewUserLoggedIn;
         _loginView.Dispose();
     }
     //Dispose the application view.
     if (null != SelectedView)
     {
         SelectedView.Dispose();
     }
 }
Ejemplo n.º 11
0
        private void HandleLoadFromString(object sender, EventArgs e)
        {
            var view = SelectedView as CustomWebView;

            if (view is null)
            {
                return;
            }

            Guid sourceKey = Guid.NewGuid();

            view.AddSource(sourceKey, new StringSource("Hello, world!", "text/html"));
            var request = new CefRequest();

            request.Url = "http://example.com";
            request.SetReferrer("https://www.google.com/", CefReferrerPolicy.NeverClearReferrer);
            request.SetHeaderByName("CefNet-Source", sourceKey.ToString(), false);             // see CustomWebViewGlue.GetResourceHandler()
            SelectedView?.GetMainFrame().LoadRequest(request);
        }
Ejemplo n.º 12
0
        private async void Animate()
        {
            if (SelectedIndex == 0)
            {
                FirstLabel.TextColor  = Color.Black;
                SecondLabel.TextColor = Color.FromHex("#E5E5E5");

                await SelectedView.TranslateTo(0, SelectedView.TranslationY, 100);
            }
            else if (SelectedIndex == 1)
            {
                SecondLabel.TextColor = Color.Black;
                FirstLabel.TextColor  = Color.FromHex("#E5E5E5");

                await SelectedView.TranslateTo((this.Width / 2) - 17, SelectedView.TranslationY, 100);
            }

            Clicked?.Invoke(this, EventArgs.Empty);
        }
Ejemplo n.º 13
0
        void ReleaseDesignerOutlets()
        {
            if (OptionLabel != null)
            {
                OptionLabel.Dispose();
                OptionLabel = null;
            }

            if (SelectedView != null)
            {
                SelectedView.Dispose();
                SelectedView = null;
            }

            if (ViewInside != null)
            {
                ViewInside.Dispose();
                ViewInside = null;
            }
        }
        private void CodeViewSwitcher_Click(object sender, EventArgs e)
        {
            Point ptCursorLoc = this.PointToClient(Cursor.Position);

            if ((ptCursorLoc.X >= 0) && (ptCursorLoc.X <= (m_iButtonWidth + (m_iRadius * 2))))
            {
                m_svCurView = SelectedView.Microcode;
            }
            else if ((ptCursorLoc.X > pbSwitchIcon.Right) && (ptCursorLoc.X <= this.Width))
            {
                m_svCurView = SelectedView.MainProgram;
            }

            if (SelectionChanged != null)
            {
                SelectionChanged(this, m_svCurView);
            }

            this.Invalidate();
        }
        public CodeViewSwitcher()
        {
            InitializeComponent();

            m_cSelectedColor   = Color.FromArgb(85, 85, 85);
            m_cDeselectedColor = Color.FromArgb(163, 163, 163);
            m_bshFillBrush     = new SolidBrush(m_cSelectedColor);

            m_bshTextBrush = new SolidBrush(Color.White);

            m_svCurView    = SelectedView.Microcode;
            m_iRadius      = 11;
            m_iButtonWidth = 110;

            m_iFontSize = 11;
            m_fntFont   = FontVault.GetFontVault().GetFont(FontVault.AvailableFonts.MyriadPro, m_iFontSize);

            this.Paint  += new PaintEventHandler(CodeViewSwitcher_Paint);
            this.Resize += new EventHandler(CodeViewSwitcher_Resize);
            this.Click  += new EventHandler(CodeViewSwitcher_Click);
        }
Ejemplo n.º 16
0
 private void HandlePrintToPdf(object sender, EventArgs e)
 {
     using (var dialog = new SaveFileDialog())
     {
         var settings = new CefPdfPrintSettings
         {
             HeaderFooterUrl = SelectedView.GetMainFrame().Url
         };
         try
         {
             dialog.Filter = "PDF file|*.pdf";
             if (dialog.ShowDialog() == DialogResult.OK)
             {
                 SelectedView.PrintToPdf(dialog.FileName, settings);
             }
         }
         finally
         {
             settings.Dispose();
         }
     }
 }
Ejemplo n.º 17
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="FormAbout" /> class.
        /// </summary>
        public FormAbout(SelectedView selectedView)
        {
            InitializeComponent();
            Text = $"About {Program.AssemblyTitle}";
            labelProductName.Text = Program.AssemblyProduct;
            labelVersion.Text     =
                $"Version {Program.AssemblyVersionShort} (build {Program.AssemblyVersionBuild} compiled {Program.AssemblyCompileTime})";
            labelCopyright.Text     = Program.AssemblyCopyright;
            textBoxDescription.Text = Program.AssemblyDescription;

            if (selectedView == SelectedView.ToDo)
            {
                radioButtonToDo.Checked = true;
            }
            else if (selectedView == SelectedView.History)
            {
                radioButtonHistory.Checked = true;
            }
            else
            {
                radioButtonReadMe.Checked = true;
            }
        }
        public BranchesAndTagsViewController(
            string username,
            string repository,
            SelectedView selectedView = SelectedView.Branches)
        {
            _branchesViewController = new BranchesViewController(username, repository);
            _tagsViewController     = new TagsViewController(username, repository);

            OnActivation(d =>
            {
                d(_viewSegment
                  .GetChangedObservable()
                  .Subscribe(SegmentValueChanged));
            });

            Appearing
            .Take(1)
            .Select(_ => (int)selectedView)
            .Do(x => _viewSegment.SelectedSegment = x)
            .Do(SegmentValueChanged)
            .Subscribe();

            NavigationItem.TitleView = _viewSegment;
        }
Ejemplo n.º 19
0
 public void OkEditView()
 {
     SelectedView.OnPropertyChanged(nameof(ViewsModel.NameOfView));
     OnPropertyChanged(nameof(Views));
 }
Ejemplo n.º 20
0
 public void CalendarClone_Click(object sender, EventArgs e)
 {
     SelectedView.CloneDay();
 }
Ejemplo n.º 21
0
        /// <summary>
        /// Constructor
        /// </summary>
        public MainViewModel()
        {
            // Create our commands
            OpenDataFile       = new DelegatingCommand(OpenFileDataSource);
            ActivateView       = new DelegatingCommand <BioViewModel>(OnActivateView);
            CloseApplication   = new DelegatingCommand(RaiseCloseRequest);
            CloseCurrentView   = new DelegatingCommand(() => SelectedView.RaiseCloseRequest(), () => SelectedView != null);
            CreateNewWorkspace = new DelegatingCommand(OnCreateNewWorkspace);

            OpenFileMenu = new ObservableCollection <MenuItem>();

            // Initialize MEF and add ourselves and the data loaders
            try
            {
                MefManager.Current.ComposeParts(this, Extensions.Current);
            }
            catch (CompositionException ex)
            {
                var errorVisualizer = ServiceProvider.Resolve <IErrorVisualizer>();
                if (errorVisualizer != null)
                {
                    errorVisualizer.Show("Failed to locate required components", ex.Message);
                }
                Environment.Exit(-1);
            }

            // Get all the loaders
            var formatLoaders = Extensions.Current.DataProviders;

            if (formatLoaders == null || formatLoaders.Count() == 0)
            {
                var errorVisualizer = ServiceProvider.Resolve <IErrorVisualizer>();
                if (errorVisualizer != null)
                {
                    errorVisualizer.Show("Failed to locate required components", "No Data Providers found - make sure all required assemblies are copied into the deployment directory.");
                }
                Environment.Exit(-1);
            }

            // Register file format styles
            formatLoaders
            .Where(fl => !String.IsNullOrEmpty(fl.FileFilter))
            .Select(fl => fl.FileFilter)
            .ForEach(RegisterFileExtension);

            // Register with message mediator
            RegisterWithMessageMediator();

            // Setup the docked views + menu handlers
            AllViews        = new ObservableCollection <BioViewModel>();
            DockedViews     = new ObservableCollection <BioViewModel>();
            SidebarItems    = new ObservableCollection <ISidebarViewItem>();
            OpenDataSources = new ObservableCollection <SelectionViewModel>();

            // See if we have files we can open.  If so, add a File|Open DataFile menu option.
            if (formatLoaders.Any(ldr => !string.IsNullOrEmpty(ldr.FileFilter)))
            {
                OpenFileMenu.Add(new MenuItem("Data _File")
                {
                    Command = OpenDataFile, GestureText = "CTRL+O"
                });
            }

            // Add in data sources which are not file based.  Each one of these gets its own menu item.
            foreach (var ldr in formatLoaders.Where(ldr => string.IsNullOrEmpty(ldr.FileFilter)))
            {
                var innerLoader = ldr;
                OpenFileMenu.Add(new MenuItem(ldr.Description)
                {
                    Command = new DelegatingCommand(() => OpenDbDataSource(innerLoader))
                });
            }
        }
Ejemplo n.º 22
0
 public void SetSelectedView(SelectedView selectedView)
 {
     var index = (int)selectedView;
     if (index != tabButtons.CheckedIndex)
         tabButtons.CheckedIndex = (int)selectedView;
 }
Ejemplo n.º 23
0
        private void InitalizeComponent2()
        {
            ToolStripMenuItem submenu;

            submenu = new ToolStripMenuItem("File");
            submenu.DropDownItems.AddRange(new ToolStripItem[] {
                new ToolStripMenuItem("Add Tab", null, HandleAddTab)
                {
                    Tag = true
                },
                new ToolStripMenuItem("Add Tab (new context)", null, HandleAddTab)
                {
                    Tag = false
                },
                new ToolStripMenuItem("Show Device Simulator", null, HandleShowSimulator),
                new ToolStripMenuItem("Print to PDF", null, HandlePrintToPdf),
                new ToolStripMenuItem("Test2", null, Button2_Click),
                new ToolStripMenuItem("Main Process", null, new ToolStripItem[] {
                    new ToolStripMenuItem("Test ScriptableObject", null, async(s, e) => await ScriptableObjectTests.ScriptableObjectTestAsync(SelectedView.GetMainFrame())),
                    new ToolStripMenuItem("Call GC.Collect()", null, (s, e) => GC.Collect()),
                }),
                new ToolStripMenuItem("Renderer process", null, new ToolStripItem[] {
                    new ToolStripMenuItem("Test ScriptableObject", null, (s, e) => ScriptableObjectTests.SendTestScriptableObjectToRenderer(SelectedView.GetMainFrame())),
                    new ToolStripMenuItem("Call GC.Collect()", null, (s, e) => ScriptableObjectTests.SendGCCollectToRenderer(SelectedView.GetMainFrame())),
                })
            });

            menu = new MenuStrip();
            menu.Items.Add(submenu);
            this.Controls.Add(menu);

            btnBack      = new Button();
            btnBack.Text = "<";
            btnBack.UseVisualStyleBackColor = true;
            btnBack.Top    = menu.Bottom;
            btnBack.Width  = btnBack.Height;
            btnBack.Anchor = AnchorStyles.Left | AnchorStyles.Top;
            this.Controls.Add(btnBack);

            btnForward      = new Button();
            btnForward.Text = ">";
            btnForward.UseVisualStyleBackColor = true;
            btnForward.Left   = btnBack.Right;
            btnForward.Top    = menu.Bottom;
            btnForward.Width  = btnForward.Height;
            btnForward.Anchor = AnchorStyles.Left | AnchorStyles.Top;
            this.Controls.Add(btnForward);

            btnGo      = new Button();
            btnGo.Text = "Go";
            btnGo.UseVisualStyleBackColor = true;
            btnGo.Left   = btnForward.Right;
            btnGo.Top    = menu.Bottom;
            btnGo.Width  = btnGo.Height * 2;
            btnGo.Anchor = AnchorStyles.Left | AnchorStyles.Top;
            btnGo.Click += new System.EventHandler(this.BtnGo_Click);
            this.Controls.Add(btnGo);


            txtAddress          = new TextBox();
            txtAddress.KeyDown += HandleAddressKeyDown;
            txtAddress.Top      = menu.Bottom;
            txtAddress.Left     = btnGo.Right;
            txtAddress.Width    = ClientSize.Width - txtAddress.Left;
            txtAddress.Anchor   = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;
            this.Controls.Add(txtAddress);

            tabs                       = new WebViewTabControl();
            tabs.Top                   = txtAddress.Bottom;
            tabs.Width                 = ClientSize.Width;
            tabs.Height                = ClientSize.Height - tabs.Top;
            tabs.Anchor                = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom;
            tabs.ControlAdded         += Tabs_ControlAdded;
            tabs.ControlRemoved       += Tabs_ControlRemoved;
            tabs.SelectedIndexChanged += Tabs_SelectedIndexChanged;
            this.Controls.Add(tabs);
        }
Ejemplo n.º 24
0
 public void CalendarPaste_Click(object sender, EventArgs e)
 {
     SelectedView.PasteDay();
 }
Ejemplo n.º 25
0
		protected void SetDocumentSelected (bool value, UIView frameView, bool animated)
		{
			if (value == selected)
				return;
			selected = value;

			if (selected) {
				if (selectedView == null) {
					selectedView = new SelectedView {
						Alpha = animated ? 0 : 1,
					};
					frameView.AddSubview (selectedView);
				}
				selectedView.Frame = frameView.Bounds;
				if (animated) {
					UIView.Animate (0.1, () => selectedView.Alpha = 1);
				} else {
					selectedView.Alpha = 1;
				}
			} else {
				if (selectedView != null) {
					if (animated) {
						UIView.Animate (0.1, () => selectedView.Alpha = 0);
					} else {
						selectedView.Alpha = 0;
					}
				}
			}
		}
Ejemplo n.º 26
0
 public void CalendarCopy_Click(object sender, EventArgs e)
 {
     SelectedView.CopyDay();
 }