Exemple #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            prepareViews();

            Title             = ViewModel.Title;
            VersionLabel.Text = ViewModel.Version;

            LoggingOutView.Hidden          = true;
            SendFeedbackSuccessView.Hidden = true;

            this.Bind(ViewModel.Email, EmailLabel.Rx().Text());
            this.Bind(ViewModel.IsSynced, SyncedView.Rx().IsVisible());
            this.Bind(ViewModel.WorkspaceName, WorkspaceLabel.Rx().Text());
            this.Bind(ViewModel.DurationFormat, DurationFormatLabel.Rx().Text());
            this.Bind(ViewModel.IsRunningSync, SyncingView.Rx().IsVisible());
            this.Bind(ViewModel.DateFormat, DateFormatLabel.Rx().Text());
            this.Bind(ViewModel.BeginningOfWeek, BeginningOfWeekLabel.Rx().Text());
            this.Bind(ViewModel.IsFeedbackSuccessViewShowing, SendFeedbackSuccessView.Rx().AnimatedIsVisible());
            this.BindVoid(ViewModel.LoggingOut, () =>
            {
                LoggingOutView.Hidden = false;
                SyncingView.Hidden    = true;
                SyncedView.Hidden     = true;
            });

            this.Bind(HelpView.Rx().Tap(), ViewModel.OpenHelpView);
            this.Bind(LogoutButton.Rx().Tap(), ViewModel.TryLogout);
            this.Bind(AboutView.Rx().Tap(), ViewModel.OpenAboutView);
            this.Bind(FeedbackView.Rx().Tap(), ViewModel.SubmitFeedback);
            this.Bind(DateFormatView.Rx().Tap(), ViewModel.SelectDateFormat);
            this.Bind(WorkspaceView.Rx().Tap(), ViewModel.PickDefaultWorkspace);
            this.Bind(DurationFormatView.Rx().Tap(), ViewModel.SelectDurationFormat);
            this.BindVoid(ManualModeSwitch.Rx().Changed(), ViewModel.ToggleManualMode);
            this.Bind(BeginningOfWeekView.Rx().Tap(), ViewModel.SelectBeginningOfWeek);
            this.Bind(CalendarSettingsView.Rx().Tap(), ViewModel.OpenCalendarSettingsAction);
            this.BindVoid(SendFeedbackSuccessView.Rx().Tap(), ViewModel.CloseFeedbackSuccessView);
            this.Bind(NotificationSettingsView.Rx().Tap(), ViewModel.OpenNotificationSettingsAction);
            this.Bind(TwentyFourHourClockSwitch.Rx().Changed(), ViewModel.ToggleUseTwentyFourHourClock);

            UIApplication.Notifications
            .ObserveWillEnterForeground((sender, e) => startAnimations())
            .DisposedBy(DisposeBag);

            if (!ViewModel.CalendarSettingsEnabled)
            {
                hideCalendarSettingsSection();
            }

            ViewModel.IsManualModeEnabled
            .FirstAsync()
            .Subscribe(isEnabled => ManualModeSwitch.SetState(isEnabled, false))
            .DisposedBy(DisposeBag);

            ViewModel.UseTwentyFourHourFormat
            .FirstAsync()
            .Subscribe(useTwentyFourHourFormat => TwentyFourHourClockSwitch.SetState(useTwentyFourHourFormat, false))
            .DisposedBy(DisposeBag);
        }
Exemple #2
0
        private void TryAndPlaceNode(string key)
        {
            string nodeName = GetNodeNameFromKeysEntered(NodeShortcuts, key);

            if (nodeName != null)
            {
                DynamoViewModel      vm = view.DataContext as DynamoViewModel;
                System.Windows.Point pnt;
                System.Windows.Point adjusted = new System.Windows.Point(0, 0);
                try
                {
                    //todo playl with how to apply the scale and x/y values.  x/y kind works
                    WorkspaceView wsV = view.ChildOfType <WorkspaceView>();
                    pnt = Mouse.GetPosition(wsV);
                    double scale = wsV.ViewModel.Zoom;
                    double X     = wsV.ViewModel.Model.X;
                    double Y     = wsV.ViewModel.Model.Y;
                    adjusted = new System.Windows.Point(pnt.X / scale - X / scale, pnt.Y / scale - Y / scale);
                }
                catch (Exception)
                {
                    pnt = new System.Windows.Point(0, 0);
                }
                try
                {
                    vm.Model.ExecuteCommand(new CreateNodeCommand(Guid.NewGuid().ToString(), nodeName, adjusted.X, adjusted.Y, false, false));
                }
                catch
                {
                }
            }
        }
Exemple #3
0
        public override bool Execute(DotSpatial.Data.ICancelProgressHandler cancelProgressHandler)
        {
            var vec = GetVector(Matrix);

            if (vec != null)
            {
                var    dou_vec  = MatrixOperation.ToDouble(vec);
                string vec_name = "CDF of " + GetName(Matrix);
                int    nlen     = dou_vec.Length;
                cancelProgressHandler.Progress("Package_Tool", 10, "Calculating...");
                Array.Sort <double>(dou_vec);
                var cdf       = MathNet.Numerics.Statistics.Statistics.EmpiricalCDFFunc(dou_vec);
                var cdf_value = new double[nlen];
                for (int i = 0; i < nlen; i++)
                {
                    cdf_value[i] = cdf(dou_vec[i]);
                }
                WorkspaceView.Plot <double>(dou_vec, cdf_value, vec_name, Models.UI.MySeriesChartType.FastLine);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #4
0
        /// <summary>
        /// On Key down, one of two things will happen:
        /// 1) This is the first key being held down and we store it
        /// 2) This is the second key being pressed, and we initiate
        ///    adding a node to the graph
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void View_KeyDown(object sender, KeyEventArgs e)
        {
            if (lastChar == null)
            {
                char[] chars = e.Key.ToString().ToCharArray();
                if (chars.Length == 1)
                {
                    lastChar = chars[0];
                }
            }
            else
            {
                WorkspaceView      wsV  = View.ChildOfType <WorkspaceView>();
                WorkspaceViewModel wsVM = wsV.ViewModel as WorkspaceViewModel;

                var sel = wsVM.Model.CurrentSelection;
                var childrenNodeViews = View.ChildrenOfType <NodeView>();

                char[] chars = e.Key.ToString().ToCharArray();
                if (chars.Length == 1)
                {
                    string key = lastChar.ToString() + chars[0].ToString();

                    TryAndPlaceNode(key);
                    lastChar = null;
                }
            }
        }
Exemple #5
0
        public override bool Execute(DotSpatial.Data.ICancelProgressHandler cancelProgressHandler)
        {
            var vec      = GetVector(Matrix);
            var var_name = GetName(Matrix);

            if (vec != null)
            {
                if (Number <= 0)
                {
                    Number = 10;
                }
                if (Number >= 100)
                {
                    Number = 100;
                }
                var vec_name = "Histogram of " + GetName(Matrix);
                cancelProgressHandler.Progress("Package_Tool", 10, "Calculating...");
                var   dou_vec = MatrixOperation.ToDouble(vec);
                var   hist    = new Histogram(dou_vec, Number);
                int   nhist   = hist.BucketCount;
                int[] xx      = new int[nhist];
                int[] yy      = new int[nhist];
                for (int i = 0; i < nhist; i++)
                {
                    xx[i] = (int)((hist[i].LowerBound + hist[i].UpperBound) * 0.5);
                    yy[i] = (int)hist[i].Count;
                }
                WorkspaceView.Plot <int>(xx, yy, vec_name, Models.UI.MySeriesChartType.Column);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #6
0
        private void OpenSettingsDialog(Object state)
        {
            _timerForOpenSettingsDialog.Dispose();
            _timerForOpenSettingsDialog = null;
            var tab = state as String;

            WorkspaceView.OpenSettingsDialog(tab);
        }
Exemple #7
0
        public Shell(Func <WorkspaceView> projectViewFactory,
                     CollectionSettings collectionSettings,
                     BookDownloadStartingEvent bookDownloadStartingEvent,
                     LibraryClosing libraryClosingEvent,
                     QueueRenameOfCollection queueRenameOfCollection,
                     ControlKeyEvent controlKeyEvent)
        {
            queueRenameOfCollection.Subscribe(newName => _nameToChangeCollectionUponClosing = newName.Trim().SanitizeFilename('-'));
            _collectionSettings  = collectionSettings;
            _libraryClosingEvent = libraryClosingEvent;
            _controlKeyEvent     = controlKeyEvent;
            InitializeComponent();

            //bring the application to the front (will normally be behind the user's web browser)
            bookDownloadStartingEvent.Subscribe((x) =>
            {
                try
                {
                    this.Invoke((Action)this.Activate);
                }
                catch (Exception e)
                {
                    Debug.Fail("(Debug Only) Can't bring to front in the current state: " + e.Message);
                    //swallow... so we were in some state that we couldn't come to the front... that's ok.
                }
            });


#if DEBUG
            WindowState = FormWindowState.Normal;
            //this.FormBorderStyle = FormBorderStyle.None;  //fullscreen

            Size = new Size(1024, 720);
#else
            // We only want this screen size context menu in Debug mode
            ContextMenuStrip = null;
#endif
            _workspaceView = projectViewFactory();
            _workspaceView.CloseCurrentProject += ((x, y) =>
            {
                UserWantsToOpenADifferentProject = true;
                Close();
            });

            _workspaceView.ReopenCurrentProject += ((x, y) =>
            {
                UserWantsToOpeReopenProject = true;
                Close();
            });

            _workspaceView.BackColor =
                System.Drawing.Color.FromArgb(64, 64, 64);
            _workspaceView.Dock = System.Windows.Forms.DockStyle.Fill;

            this.Controls.Add(this._workspaceView);

            SetWindowText(null);
        }
Exemple #8
0
        protected void CreateWorkspace(WorkspaceViewModel mdl, bool activate)
        {
            var workspace = new WorkspaceView(); // TODO: delegate to data store / TypeDescriptor

            workspace.DataContext = mdl;
            workspace.Closed     += new EventHandler(workspace_Closed);
            workspace.Show();
            _workspaces.Add(workspace);
        }
Exemple #9
0
        public void AreGlobalLacingStrategiesInMenu()
        {
            // Mock a WorkspaceView
            var workspaceView = new WorkspaceView();

            // Search the associated context menu for the lacing sub-menu
            var contextMenu = workspaceView.FindName("WorkspaceLacingMenu") as MenuItem;

            // Auto, Shortest, Longest, Cross Product
            Assert.AreEqual(contextMenu.Items.Count, 4);
        }
 private static void CreateUiLanguageMenuButton()
 {
     s_toolStripDropDownButton = new ToolStripDropDownButton
     {
         AutoSize  = true,
         Alignment = ToolStripItemAlignment.Right,
         Text      = "English",
         // Shares the tooltip string with OpenCreateNewCollectionsDialog.UILanguageMenu
         ToolTipText = L10NSharp.LocalizationManager.GetString("OpenCreateNewCollectionsDialog.UILanguageMenu_ToolTip_", "Change user interface language")
     };
     WorkspaceView.SetupUiLanguageMenuCommon(s_toolStripDropDownButton, FinishUiLanguageMenuItemClick);
 }
Exemple #11
0
 /// <summary>
 /// Returns json with property languages, an array of objects (one for each UI language Bloom knows about)
 /// each having label (what to show in a menu) and tag (the language code).
 /// Used in language select control in hint bubbles tab of text box properties dialog
 /// brought up from cog control in origami mode.
 /// </summary>
 /// <param name="request"></param>
 public void HandleUiLanguages(ApiRequest request)
 {
     lock (request)
     {
         var langs = new List <object>();
         foreach (var code in L10NSharp.LocalizationManager.GetAvailableLocalizedLanguages())
         {
             var langItem = WorkspaceView.CreateLanguageItem(code);
             langs.Add(new { label = langItem.MenuText, tag = code });
         }
         request.ReplyWithJson(JsonConvert.SerializeObject(new { languages = langs }));
     }
 }
Exemple #12
0
 public void UpdateUiLanguageMenuSelection()
 {
     foreach (ToolStripDropDownItem item in _uiLanguageMenu.DropDownItems)
     {
         var tag = (LanguageItem)item.Tag;
         if (tag.IsoCode == Settings.Default.UserInterfaceLanguage)
         {
             item.Select();
             WorkspaceView.UpdateMenuTextToShorterNameOfSelection(_uiLanguageMenu, item.Text);
             return;
         }
     }
 }
 public void UpdateUiLanguageMenuSelection()
 {
     foreach (ToolStripDropDownItem item in _uiLanguageMenu.DropDownItems)
     {
         CultureInfo cultureInfo = (CultureInfo)item.Tag;
         if (cultureInfo.IetfLanguageTag == Settings.Default.UserInterfaceLanguage)
         {
             item.Select();
             WorkspaceView.UpdateMenuTextToShorterNameOfSelection(_uiLanguageMenu, cultureInfo);
             return;
         }
     }
 }
Exemple #14
0
        public override bool Execute(DotSpatial.Data.ICancelProgressHandler cancelProgressHandler)
        {
            var vecX = GetVector(MatrixX);

            if (vecX != null)
            {
                WorkspaceView.Plot <float>(vecX, SeriesTitle, Models.UI.MySeriesChartType.FastLine);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #15
0
        public void ViewTest()
        {
            P4Server      pserver  = new P4Server(false);
            P4Workspace   target   = new P4Workspace(pserver, "Fred");
            WorkspaceView expected = new WorkspaceView(pserver, new String[] { "//depot/a //workspace/a" });
            WorkspaceView actual;

            target.View = expected;
            actual      = target.View;
            Assert.AreEqual(expected.Count, actual.Count);
            Assert.AreEqual(expected.GetLeft(0), actual.GetLeft(0));
            Assert.AreEqual(expected.GetRight(0), actual.GetRight(0));
            Assert.AreEqual(expected.GetType(0), actual.GetType(0));
        }
Exemple #16
0
        public Shell(Func <WorkspaceView> projectViewFactory, CollectionSettings collectionSettings, LibraryClosing libraryClosingEvent, QueueRenameOfCollection queueRenameOfCollection, Sparkle _sparkle)
        {
            queueRenameOfCollection.Subscribe(newName => _nameToChangeCollectionUponClosing = newName);
            _collectionSettings  = collectionSettings;
            _libraryClosingEvent = libraryClosingEvent;
            InitializeComponent();



#if DEBUG
            WindowState = FormWindowState.Normal;
            //this.FormBorderStyle = FormBorderStyle.None;  //fullscreen

            Size = new Size(1024, 720);
#endif
            _workspaceView = projectViewFactory();
            _workspaceView.CloseCurrentProject += ((x, y) =>
            {
                UserWantsToOpenADifferentProject = true;
                Close();
            });

            _sparkle.AboutToExitForInstallerRun += ((x, cancellable) =>
            {
                cancellable.Cancel = false;
                QuitForVersionUpdate = true;
                Close();
            });

            _workspaceView.ReopenCurrentProject += ((x, y) =>
            {
                UserWantsToOpeReopenProject = true;
                Close();
            });

            SystemEvents.SessionEnding += ((x, y) =>
            {
                QuitForSystemShutdown = true;
                Close();
            });

            _workspaceView.BackColor =
                System.Drawing.Color.FromArgb(64, 64, 64);
            _workspaceView.Dock = System.Windows.Forms.DockStyle.Fill;

            this.Controls.Add(this._workspaceView);


            SetWindowText();
        }
Exemple #17
0
        public void WorkspaceViewConstructorTest()
        {
            bool unicode = false;

            for (int i = 0; i < 2; i++)
            {
                P4Server   pserver = new P4Server(unicode);
                StringList text    = new StringList();
                text.Add("//depot/... //workspace/depot/...");
                text.Add("//usr/... //workspace/usr/...");

                WorkspaceView target = new WorkspaceView(pserver, text);

                Assert.AreEqual(target.Count, 2);
            }
        }
Exemple #18
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            LoadState(out _cModel, out _wsModel);

            var editorContext = new EditorViewModel(_cModel, _wsModel);

            _EditorView = new EditorView(editorContext);
            editorContext.RaiseDoneEditingEvent += CloseCanvas;

            _mainViewModel = new WorkspaceViewModel(_cModel, _wsModel);
            _MainView      = new WorkspaceView(_mainViewModel);
            _mainViewModel.RaiseEditCanvasEvent += OpenCanvas;
            _MainView.Show();
        }
Exemple #19
0
        // Create a new Workspace using workspace view
        public async Task <Workspace> CreateWorkspace(WorkspaceView workSpace)
        {
            Workspace newWorkspace = new Workspace
            {
                WorkspaceId   = workSpace.Id,
                WorkspaceName = workSpace.WorkspaceName
            };

            await _dbWorkSpace.InsertOneAsync(newWorkspace);

            //creating default channels in workspace
            foreach (var channel in workSpace.Channels)
            {
                Channel newChannel = new Channel
                {
                    ChannelName = channel.ChannelName,
                    //Admin = user,
                    WorkspaceId = newWorkspace.WorkspaceId
                };
                // newChannel.Users.Add(user);
                await CreateDefaultChannel(newChannel, workSpace.WorkspaceName);
            }
            foreach (var bot in workSpace.Bots)
            {
                UserAccountView newBot = new UserAccountView
                {
                    EmailId   = bot.EmailId,
                    FirstName = bot.Name,
                    LastName  = "Bot",
                    Id        = bot.Id
                };
                await AddUserToWorkspace(newBot, workSpace.WorkspaceName);
            }

            // adding default bot for interspace communication
            UserAccountView newUser = new UserAccountView
            {
                EmailId   = "*****@*****.**",
                FirstName = "Entre",
                LastName  = "Bot",
                Id        = "60681125-e117-4bb2-9287-eb840c4cg672"
            };

            await AddUserToWorkspace(newUser, workSpace.WorkspaceName);

            return(await GetWorkspaceById(newWorkspace.WorkspaceId));
        }
            public async Task <Workspace> CreateWorkspace(WorkspaceView workSpace)
            {
                Workspace workspace1 = new Workspace()
                {
                    Id              = workSpace.Id,
                    WorkspaceId     = "123qwe",
                    WorkspaceName   = workSpace.WorkspaceName,
                    Channels        = new List <Channel> {
                    },
                    DefaultChannels = new List <Channel> {
                    },
                    Users           = new List <User> {
                    }
                };

                return(workspace1);
            }
Exemple #21
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            prepareViews();

            Title             = ViewModel.Title;
            VersionLabel.Text = ViewModel.Version;

            LoggingOutView.Hidden          = true;
            SendFeedbackSuccessView.Hidden = true;

            this.Bind(ViewModel.Email, EmailLabel.BindText());
            this.Bind(ViewModel.IsSynced, SyncedView.BindIsVisible());
            this.Bind(ViewModel.WorkspaceName, WorkspaceLabel.BindText());
            this.Bind(ViewModel.DurationFormat, DurationFormatLabel.BindText());
            this.Bind(ViewModel.IsRunningSync, SyncingView.BindIsVisible());
            this.Bind(ViewModel.DateFormat, DateFormatLabel.BindText());
            this.Bind(ViewModel.IsManualModeEnabled, ManualModeSwitch.BindIsOn());
            this.Bind(ViewModel.BeginningOfWeek, BeginningOfWeekLabel.BindText());
            this.Bind(ViewModel.UseTwentyFourHourFormat, TwentyFourHourClockSwitch.BindIsOn());
            this.BindVoid(ViewModel.LoggingOut, () =>
            {
                LoggingOutView.Hidden = false;
                SyncingView.Hidden    = true;
                SyncedView.Hidden     = true;
            });
            this.Bind(ViewModel.IsFeedbackSuccessViewShowing, SendFeedbackSuccessView.BindAnimatedIsVisible());

            this.Bind(HelpView.Tapped(), ViewModel.OpenHelpView);
            this.Bind(LogoutButton.Tapped(), ViewModel.TryLogout);
            this.Bind(AboutView.Tapped(), ViewModel.OpenAboutView);
            this.Bind(FeedbackView.Tapped(), ViewModel.SubmitFeedback);
            this.Bind(DateFormatView.Tapped(), ViewModel.SelectDateFormat);
            this.Bind(WorkspaceView.Tapped(), ViewModel.PickDefaultWorkspace);
            this.BindVoid(ManualModeView.Tapped(), ViewModel.ToggleManualMode);
            this.Bind(DurationFormatView.Tapped(), ViewModel.SelectDurationFormat);
            this.Bind(BeginningOfWeekView.Tapped(), ViewModel.SelectBeginningOfWeek);
            this.Bind(TwentyFourHourClockView.Tapped(), ViewModel.ToggleUseTwentyFourHourClock);
            this.BindVoid(SendFeedbackSuccessView.Tapped(), ViewModel.CloseFeedbackSuccessView);

            UIApplication.Notifications
            .ObserveWillEnterForeground((sender, e) => startAnimations())
            .DisposedBy(DisposeBag);
        }
Exemple #22
0
        public IActionResult CreateWorkspace([FromBody] WorkspaceView workspace)
        {
            // before creating new workspace check if it already exists
            var searchedWorkspace = iservice.GetWorkspaceById(workspace.Id).Result;

            if (searchedWorkspace != null)
            {
                //if workspace already exists return error message
                return(NotFound("Workspace already exists"));
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            Workspace newWorkspace = iservice.CreateWorkspace(workspace).Result;

            return(new ObjectResult(newWorkspace));
        }
Exemple #23
0
        public void ToStringTest()
        {
            bool unicode = false;

            for (int i = 0; i < 2; i++)
            {
                P4Server   pserver = new P4Server(unicode);
                string     target  = "//depot/... //workspace/depot/...\r\n//usr/... //workspace/usr/...";
                StringList text    = new StringList();
                text.Add("//depot/... //workspace/depot/...");
                text.Add("//usr/... //workspace/usr/...");

                WorkspaceView testView = new WorkspaceView(pserver, text);

                string actual = testView.ToString();

                Assert.AreEqual(target.Replace("\r\n", ""), actual.Replace("\r\n", ""));
            }
        }
Exemple #24
0
        public void ToDepotDirectoryTest()
        {
            bool unicode = false;

            for (int i = 0; i < 2; i++)
            {
                P4Server   pserver = new P4Server(unicode);
                string     target  = "//depot/code";
                StringList text    = new StringList();
                text.Add("//depot/... //workspace/depot/...");
                text.Add("//usr/... //workspace/usr/...");

                WorkspaceView testView = new WorkspaceView(pserver, text);

                string actual = testView.ToDepotDirectory("//workspace/depot/code");

                Assert.AreEqual(target, actual);
            }
        }
Exemple #25
0
        public InCanvasSearchControl()
        {
            InitializeComponent();

            this.Loaded += (sender, e) =>
            {
                if (workspaceView == null)
                {
                    workspaceView = WpfUtilities.FindUpVisualTree <WorkspaceView>(this.Parent);
                }
                if (dynamoView == null)
                {
                    dynamoView = WpfUtilities.FindUpVisualTree <DynamoView>(this.Parent);
                    if (dynamoView != null)
                    {
                        dynamoView.Deactivated += (s, args) => { OnRequestShowInCanvasSearch(ShowHideFlags.Hide); }
                    }
                    ;
                }
            };
        }
        // ========================================
        // constructor
        // ========================================
        public MemopadFormMediator(
            MemopadForm mainForm,
            WorkspaceView workspaceView,
//            MemoQueryBuilderView memoQueryBuilderView,
            MemoListView memoListView
            )
        {
            Contract.Requires(workspaceView != null);
//            Contract.Requires(memoQueryBuilderView != null);
            Contract.Requires(memoListView != null);

            _facade = MemopadApplication.Instance;
            _finder = new MemoFinder();

            _mainForm      = mainForm;
            _workspaceView = workspaceView;
//            _memoQueryBuilderView = memoQueryBuilderView;
            _memoListView = memoListView;

            _memoListView.MemoListBox.CanDragStart = true;

            InitHandlers();
        }
Exemple #27
0
 public MainView()
 {
     InitializeComponent();
     _traceAndPagesView = new TraceSenderView()
     {
         Dock = DockStyle.Fill
     };
     _logView = new LogView()
     {
         Dock = DockStyle.Fill
     };
     _workspaceView = new WorkspaceView()
     {
         Dock = DockStyle.Fill
     };
     _statisticsGridView = new StatisticsGridView()
     {
         Dock = DockStyle.Fill,
     };
     _dataGridView = new FiltersGridView()
     {
         Dock = DockStyle.Fill,
     };
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            GroupSimilarTimeEntriesLabel.Text = Resources.GroupTimeEntries;
            YourProfileCellLabel.Text         = Resources.YourProfile;
            WorkspaceCellLabel.Text           = Resources.Workspace;
            FormatSettingsHeaderLabel.Text    = Resources.FormatSettings;
            DateFormatCellLabel.Text          = Resources.DateFormat;
            Use24HourClockCellLabel.Text      = Resources.Use24HourClock;
            DurationFormatCellLabel.Text      = Resources.DurationFormat;
            FirstDayOfTheWeekCellLabel.Text   = Resources.FirstDayOfTheWeek;
            ManualModeCellLabel.Text          = Resources.ManualMode;
            ManualModeDescriptionLabel.Text   = Resources.ManualModeDescription;
            CalendarSettingsCellLabel.Text    = Resources.CalendarSettingsTitle;
            SmartAlertCellLabel.Text          = Resources.SmartAlerts;
            SubmitFeedbackCellLabel.Text      = Resources.SubmitFeedback;
            AboutCellLabel.Text          = Resources.About;
            HelpCellLabel.Text           = Resources.Help;
            LoggingOutLabel.Text         = Resources.LoggingOutSecurely;
            SyncingLabel.Text            = Resources.Syncing;
            SyncedLabel.Text             = Resources.SyncCompleted;
            FeedbackToastTitleLabel.Text = Resources.DoneWithExclamationMark.ToUpper();
            FeedbackToastTextLabel.Text  = Resources.ThankYouForTheFeedback;
            LogoutButton.SetTitle(Resources.SignOutOfToggl, UIControlState.Normal);

            prepareViews();

            Title             = ViewModel.Title;
            VersionLabel.Text = ViewModel.Version;

            LoggingOutView.Hidden          = true;
            SendFeedbackSuccessView.Hidden = true;

            ViewModel.Email
            .Subscribe(EmailLabel.Rx().Text())
            .DisposedBy(DisposeBag);

            ViewModel.IsSynced
            .Subscribe(SyncedView.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.WorkspaceName
            .Subscribe(WorkspaceLabel.Rx().Text())
            .DisposedBy(DisposeBag);

            ViewModel.DurationFormat
            .Subscribe(DurationFormatLabel.Rx().Text())
            .DisposedBy(DisposeBag);

            ViewModel.IsRunningSync
            .Subscribe(SyncingView.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.DateFormat
            .Subscribe(DateFormatLabel.Rx().Text())
            .DisposedBy(DisposeBag);

            ViewModel.BeginningOfWeek
            .Subscribe(BeginningOfWeekLabel.Rx().Text())
            .DisposedBy(DisposeBag);

            ViewModel.IsFeedbackSuccessViewShowing
            .Subscribe(SendFeedbackSuccessView.Rx().AnimatedIsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.LoggingOut
            .Subscribe(_ =>
            {
                LoggingOutView.Hidden = false;
                SyncingView.Hidden    = true;
                SyncedView.Hidden     = true;
            })
            .DisposedBy(DisposeBag);

            HelpView.Rx()
            .BindAction(ViewModel.OpenHelpView)
            .DisposedBy(DisposeBag);

            LogoutButton.Rx()
            .BindAction(ViewModel.TryLogout)
            .DisposedBy(DisposeBag);

            AboutView.Rx()
            .BindAction(ViewModel.OpenAboutView)
            .DisposedBy(DisposeBag);

            FeedbackView.Rx()
            .BindAction(ViewModel.SubmitFeedback)
            .DisposedBy(DisposeBag);

            DateFormatView.Rx()
            .BindAction(ViewModel.SelectDateFormat)
            .DisposedBy(DisposeBag);

            WorkspaceView.Rx()
            .BindAction(ViewModel.PickDefaultWorkspace)
            .DisposedBy(DisposeBag);

            DurationFormatView.Rx()
            .BindAction(ViewModel.SelectDurationFormat)
            .DisposedBy(DisposeBag);

            ManualModeSwitch.Rx().Changed()
            .Subscribe(ViewModel.ToggleManualMode)
            .DisposedBy(DisposeBag);

            GroupSimilarTimeEntriesSwitch.Rx()
            .BindAction(ViewModel.ToggleTimeEntriesGrouping)
            .DisposedBy(DisposeBag);

            BeginningOfWeekView.Rx()
            .BindAction(ViewModel.SelectBeginningOfWeek)
            .DisposedBy(DisposeBag);

            CalendarSettingsView.Rx()
            .BindAction(ViewModel.OpenCalendarSettings)
            .DisposedBy(DisposeBag);

            SendFeedbackSuccessView.Rx().Tap()
            .Subscribe(ViewModel.CloseFeedbackSuccessView)
            .DisposedBy(DisposeBag);

            NotificationSettingsView.Rx()
            .BindAction(ViewModel.OpenNotificationSettings)
            .DisposedBy(DisposeBag);

            TwentyFourHourClockSwitch.Rx().Changed()
            .Subscribe(ViewModel.ToggleTwentyFourHourSettings.Inputs)
            .DisposedBy(DisposeBag);

            UIApplication.Notifications
            .ObserveWillEnterForeground((sender, e) => startAnimations())
            .DisposedBy(DisposeBag);

            if (!ViewModel.CalendarSettingsEnabled)
            {
                hideCalendarSettingsSection();
            }

            ViewModel.IsManualModeEnabled
            .FirstAsync()
            .Subscribe(isEnabled => ManualModeSwitch.SetState(isEnabled, false))
            .DisposedBy(DisposeBag);

            ViewModel.IsGroupingTimeEntries
            .FirstAsync()
            .Subscribe(isGrouping => GroupSimilarTimeEntriesSwitch.SetState(isGrouping, false))
            .DisposedBy(DisposeBag);

            ViewModel.UseTwentyFourHourFormat
            .FirstAsync()
            .Subscribe(useTwentyFourHourFormat => TwentyFourHourClockSwitch.SetState(useTwentyFourHourFormat, false))
            .DisposedBy(DisposeBag);
        }
Exemple #29
0
 public static IEnumerable <NodeView> ChildNodeViews(this WorkspaceView nodeViews)
 {
     return(nodeViews.ChildrenOfType <NodeView>());
 }
Exemple #30
0
        private bool ProcessContent(IRequestInfo info, string localPath)
        {
            if (localPath.EndsWith(".css"))
            {
                return(ProcessCssFile(info, localPath));
            }

            switch (localPath)
            {
            case "currentPageContent":
                info.ContentType = "text/html";
                info.WriteCompleteOutput(CurrentPageContent ?? "");
                return(true);

            case "toolboxContent":
                info.ContentType = "text/html";
                info.WriteCompleteOutput(ToolboxContent ?? "");
                return(true);

            case "availableFontNames":
                info.ContentType = "application/json";
                var list = new List <string>(Browser.NamesOfFontsThatBrowserCanRender());
                list.Sort();
                info.WriteCompleteOutput(JsonConvert.SerializeObject(new{ fonts = list }));
                return(true);

            case "uiLanguages":
                // Returns json with property languages, an array of objects (one for each UI language Bloom knows about)
                // each having label (what to show in a menu) and tag (the language code).
                // Used in language select control in hint bubbles tab of text box properties dialog
                // brought up from cog control in origami mode.
                var langs = new List <object>();
                foreach (var lang in L10NSharp.LocalizationManager.GetUILanguages(true))
                {
                    langs.Add(new { label = WorkspaceView.MenuItemName(lang), tag = lang.IetfLanguageTag });
                }
                info.ContentType = "application/json";
                info.WriteCompleteOutput(JsonConvert.SerializeObject(new { languages = langs }));
                return(true);

            case "bubbleLanguages":
                // Returns a list of lang codes such that if a block has hints in multiple languages,
                // we prefer the one that comes first in the list.
                // Used to select the best label to show in a hint bubble when a bloom-translationGroup has multiple
                // labels with different languages.
                var bubbleLangs = new List <string>();
                bubbleLangs.Add(LocalizationManager.UILanguageId);
                if (_bookSelection.CurrentSelection.MultilingualContentLanguage2 != null)
                {
                    bubbleLangs.Add(_bookSelection.CurrentSelection.MultilingualContentLanguage2);
                }
                if (_bookSelection.CurrentSelection.MultilingualContentLanguage3 != null)
                {
                    bubbleLangs.Add(_bookSelection.CurrentSelection.MultilingualContentLanguage3);
                }
                bubbleLangs.AddRange(new [] { "en", "fr", "sp", "ko", "zh-Hans" });
                // If we don't have a hint in the UI language or any major language, it's still
                // possible the page was made just for this langauge and has a hint in that language.
                // Not sure whether this should be before or after the list above.
                // Definitely wants to be after UILangage, otherwise we get the surprising result
                // that in a French collection these hints stay French even when all the rest of the
                // UI changes to English.
                bubbleLangs.Add(_bookSelection.CurrentSelection.CollectionSettings.Language1Iso639Code);
                // if it isn't available in any of those we'll arbitrarily take the first one.
                info.ContentType = "application/json";
                info.WriteCompleteOutput(JsonConvert.SerializeObject(new { langs = bubbleLangs }));
                return(true);

            case "authorMode":
                info.ContentType = "text/plain";
                info.WriteCompleteOutput(AuthorMode ? "true" : "false");
                return(true);

            case "topics":
                return(GetTopicList(info));
            }
            return(ProcessAnyFileContent(info, localPath));
        }