public override void Initialize(ICloudSourceContext context)
        {
            base.Initialize(context);

            InvalidateProjectOrAccount();
            UpdateContextMenu();
        }
Example #2
0
        protected override void BeforeEach()
        {
            _loadDataSource = new TaskCompletionSource <IList <TreeNode> >();

            _mockedContext   = Mock.Of <ICloudSourceContext>();
            _objectUnderTest = Mock.Of <SourceRootViewModelBase>(
                o => o.RootCaption == MockRootCaption &&
                o.ErrorPlaceholder == s_errorPlaceholder &&
                o.LoadingPlaceholder == s_loadingPlaceholder &&
                o.NoItemsPlaceholder == s_noItemsPlaceholder);
            _objectUnderTestMock          = Mock.Get(_objectUnderTest);
            _objectUnderTestMock.CallBase = true;
            _objectUnderTestMock.Protected().Setup <Task>("LoadDataOverride").Returns(
                async() =>
            {
                IList <TreeNode> childNodes;
                try
                {
                    childNodes = await _loadDataSource.Task;
                }
                finally
                {
                    _loadDataSource = new TaskCompletionSource <IList <TreeNode> >();
                }
                _objectUnderTest.Children.Clear();
                foreach (TreeNode child in childNodes)
                {
                    _objectUnderTest.Children.Add(child);
                }
            });
            _objectUnderTest = _objectUnderTestMock.Object;
        }
Example #3
0
        public override void Initialize(ICloudSourceContext context)
        {
            base.Initialize(context);

            InvalidateProjectOrAccount();
            UpdateContextMenu();
        }
Example #4
0
        public override void Initialize(ICloudSourceContext context)
        {
            base.Initialize(context);

            ContextMenu = new ContextMenu
            {
                ItemsSource = new List <MenuItem>
                {
                    new MenuItem
                    {
                        Header  = Resources.CloudExplorerPubSubNewTopicMenuHeader,
                        Command = new ProtectedCommand(OnNewTopicCommand)
                    },
                    new MenuItem
                    {
                        Header  = Resources.CloudExplorerPubSubChangeFiltersMenuHeader,
                        Command = new ProtectedCommand(OnChangeFiltersCommand)
                    },
                    new MenuItem
                    {
                        Header  = Resources.UiOpenOnCloudConsoleMenuHeader,
                        Command = new ProtectedCommand(OnOpenCloudConsoleCommand)
                    }
                }
            };
        }
Example #5
0
        public void Initialize()
        {
            CredentialsStore.Default.UpdateCurrentProject(s_project);
            CredentialsStore.Default.CurrentAccount = s_userAccount;

            _loadDataSource = new TaskCompletionSource <IList <TreeNode> >();

            _mockedContext   = Mock.Of <ICloudSourceContext>(c => c.CurrentProject.ProjectId == MockProjectId);
            _objectUnderTest = Mock.Of <SourceRootViewModelBase>(
                o => o.RootCaption == MockRootCaption &&
                o.ErrorPlaceholder == s_errorPlaceholder &&
                o.LoadingPlaceholder == s_loadingPlaceholder &&
                o.NoItemsPlaceholder == s_noItemsPlaceholder);
            _objectUnderTestMock          = Mock.Get(_objectUnderTest);
            _objectUnderTestMock.CallBase = true;
            _objectUnderTestMock.Protected().Setup <Task>("LoadDataOverride").Returns(
                async() =>
            {
                IList <TreeNode> childNodes;
                try
                {
                    childNodes = await _loadDataSource.Task;
                }
                finally
                {
                    _loadDataSource = new TaskCompletionSource <IList <TreeNode> >();
                }
                _objectUnderTest.Children.Clear();
                foreach (TreeNode child in childNodes)
                {
                    _objectUnderTest.Children.Add(child);
                }
            });
            _objectUnderTest = _objectUnderTestMock.Object;
        }
 /// <summary>
 /// Internal constructor for testing.
 /// </summary>
 /// <param name="linkFormatInfo">
 /// The link info with the caption and the <see cref="string.Format(string,object[])"/> ready url format.
 /// </param>
 /// <param name="context">The <see cref="ICloudSourceContext"/>.</param>
 /// <param name="startProcess">
 /// Dependency injecion of the static function <see cref="Process.Start(string)"/>.
 /// </param>
 internal ConsoleLink(LinkInfo linkFormatInfo, ICloudSourceContext context, Func <string, Process> startProcess)
 {
     _startProcess   = startProcess;
     _context        = context;
     _linkFormatInfo = linkFormatInfo;
     Caption         = _linkFormatInfo.Caption;
     NavigateCommand = new ProtectedCommand(OnNavigateCommand);
 }
Example #7
0
 /// <summary>
 /// Creates a new Console Link tree leaf node.
 /// </summary>
 /// <param name="context">The <see cref="ICloudSourceContext"/>.</param>
 /// <param name="linkFormatInfo">
 /// The link info with the caption and the <see cref="string.Format(string,object[])"/> ready url format.
 /// </param>
 public ConsoleLink(ICloudSourceContext context, LinkInfo linkFormatInfo)
 {
     _context            = context;
     _linkFormatInfo     = linkFormatInfo;
     Caption             = _linkFormatInfo.Caption;
     NavigateCommand     = new ProtectedCommand(OnNavigateCommand);
     NavigateInfoCommand = new ProtectedCommand(OnNavigateHelpCommand, false);
 }
Example #8
0
        public virtual void Initialize(ICloudSourceContext context)
        {
            Context = context;
            Icon    = RootIcon;
            Caption = RootCaption;

            Children.Add(LoadingPlaceholder);
        }
Example #9
0
 public GceSource(ICloudSourceContext context) : base(context)
 {
     _windowsOnlyButton = new ButtonDefinition
     {
         ToolTip = Resources.CloudExplorerGceOnlyWindowsButtonToolTip,
         Command = new WeakCommand(OnOnlyWindowsClicked),
         Icon    = s_windowsOnlyButtonIcon.Value,
     };
     ActualButtons.Add(_windowsOnlyButton);
 }
Example #10
0
 public GceSource(ICloudSourceContext context) : base(context)
 {
     _windowsOnlyButton = new ButtonDefinition
     {
         ToolTip = Resources.CloudExplorerGceOnlyWindowsButtonToolTip,
         Command = new ProtectedCommand(OnOnlyWindowsCommand),
         Icon    = s_windowsOnlyButtonIcon.Value,
     };
     ActualButtons.Add(_windowsOnlyButton);
     ActualRoot.ShowOnlyWindowsInstancesChanged += OnShowOnlyWindowsInstancesChanged;
 }
        public override void Initialize(ICloudSourceContext context)
        {
            base.Initialize(context);

            InvalidateProjectOrAccount();

            var menuItems = new List<MenuItem>
            {
                new MenuItem { Header = Resources.CloudExplorerStatusMenuHeader, Command = new ProtectedCommand(OnStatusCommand) },
            };
            ContextMenu = new ContextMenu { ItemsSource = menuItems };
        }
        public void BeforeEach()
        {
            _mockedCloudSourceContext = Mock.Of <ICloudSourceContext>();
            var objectUnderTestMock =
                new Mock <CloudExplorerSourceBase <ISourceRootViewModelBase> >(_mockedCloudSourceContext)
            {
                CallBase     = true,
                DefaultValue = DefaultValue.Mock
            };

            _objectUnderTest = objectUnderTestMock.Object;
        }
Example #13
0
        public override void Initialize(ICloudSourceContext context)
        {
            base.Initialize(context);

            var menuItems = new List <MenuItem>
            {
                new MenuItem {
                    Header = Resources.CloudExplorerStatusMenuHeader, Command = new WeakCommand(OnStatusCommand)
                },
            };

            ContextMenu = new ContextMenu {
                ItemsSource = menuItems
            };

            InvalidateProjectOrAccount();
        }
 protected CloudExplorerSourceBase(ICloudSourceContext context)
 {
     Context = context;
 }
Example #15
0
 public PubsubSource(ICloudSourceContext context) : base(context)
 {
 }
 public ConsoleLinkGroup(string caption, ICloudSourceContext context, IEnumerable <LinkInfo> groupLinks) : base(
         groupLinks.Select(l => new ConsoleLink(l, context)))
 {
     Caption = caption;
 }
Example #17
0
 /// <summary>
 /// Creates a new Console Link tree leaf node.
 /// </summary>
 /// <param name="context">The <see cref="ICloudSourceContext"/>.</param>
 /// <param name="linkFormatInfo">
 /// The link info with the caption and the <see cref="string.Format(string,object[])"/> ready url format.
 /// </param>
 /// <param name="infoLinkInfo">The link info for the help section of the console link.</param>
 public ConsoleLink(ICloudSourceContext context, LinkInfo linkFormatInfo, LinkInfo infoLinkInfo) : this(context, linkFormatInfo)
 {
     InfoLinkInfo = infoLinkInfo;
     NavigateInfoCommand.CanExecuteCommand = true;
 }
 protected DynamicCloudExplorerSourceBase(ICloudSourceContext context) : base(context)
 {
     Root = new TRootViewModel();
     Root.Initialize(context);
 }
 /// <summary>
 /// Creates a new Console Link tree leaf node.
 /// </summary>
 /// <param name="linkFormatInfo">
 /// The link info with the caption and the <see cref="string.Format(string,object[])"/> ready url format.
 /// </param>
 /// <param name="context">The <see cref="ICloudSourceContext"/>.</param>
 public ConsoleLink(LinkInfo linkFormatInfo, ICloudSourceContext context) : this(
         linkFormatInfo, context, Process.Start)
 {
 }
 public CloudConsoleLinksSource(ICloudSourceContext context) : base(context)
 {
     Root = new ConsoleLinksRoot(context);
 }
 public CloudSQLSource(ICloudSourceContext context) : base(context)
 {
 }
 public CloudExplorerSourceBase(ICloudSourceContext context)
 {
     Context    = context;
     ActualRoot = new TRootViewModel();
     ActualRoot.Initialize(context);
 }
 public GaeSource(ICloudSourceContext context) : base(context)
 {
 }
Example #24
0
 public void BeforeEach()
 {
     _mockedContext   = Mock.Of <ICloudSourceContext>();
     _objectUnderTest = new TestableSourceRootViewModelBase();
 }
 public TestDynamicCloudExplorerSourceBase(ICloudSourceContext context) : base(context)
 {
 }
 public override void Initialize(ICloudSourceContext context) => InitializeMock.Object(context);
        public virtual void Initialize(ICloudSourceContext context)
        {
            Context = context;
            Icon = RootIcon;
            Caption = RootCaption;

            Children.Add(LoadingPlaceholder);
        }