예제 #1
0
        private void Initialize(Reports report)
        {
            Oee oeeType;

            switch (report)
            {
            case Reports.DisponibilityList:
            case Reports.DisponibilityCurrent:
                oeeType = new Disponibility();
                break;

            case Reports.VelocityList:
                oeeType = new Velocity();
                break;

            case Reports.QualityList:
                oeeType = new Quality();
                break;

            case Reports.AllView:
                oeeType = new AllView();
                break;

            default:
                throw new NotImplementedException();
            }

            tableName   = oeeType.GetTableName;
            columnNames = oeeType.ColumnNames;
        }
예제 #2
0
 private void ItemManipulationModel_FocusSelectedItemsInvoked(object sender, EventArgs e)
 {
     if (SelectedItems.Any())
     {
         AllView.ScrollIntoView(SelectedItems.Last(), null);
     }
 }
예제 #3
0
        protected override void SetSelectedItemsOnUi(List <ListedItem> selectedItems)
        {
            // To prevent program from crashing when the page is first loaded
            if (selectedItems.Count > 0)
            {
                var rows = new List <DataGridRow>();
                Interacts.Interaction.FindChildren <DataGridRow>(rows, AllView);
                foreach (DataGridRow row in rows)
                {
                    row.CanDrag = selectedItems.Contains(row.DataContext);
                }
            }

            // Required to check if sequences are equal, if not it will result in an infinite loop
            // between the UI Control and the BaseLayout set function
            if (Enumerable.SequenceEqual <ListedItem>(AllView.SelectedItems.Cast <ListedItem>(), selectedItems))
            {
                return;
            }
            AllView.SelectedItems.Clear();
            foreach (ListedItem selectedItem in selectedItems)
            {
                AllView.SelectedItems.Add(selectedItem);
            }
            AllView.UpdateLayout();
        }
예제 #4
0
 public override void FocusSelectedItems()
 {
     if (SelectedItems.Any())
     {
         AllView.ScrollIntoView(SelectedItems.Last(), null);
     }
 }
예제 #5
0
        private void AllView_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
        {
            if (App.CurrentInstance.ViewModel.WorkingDirectory.StartsWith(App.AppSettings.RecycleBinPath))
            {
                // Do not rename files and folders inside the recycle bin
                AllView.CancelEdit(); // cancel the edit operation
                return;
            }

            // Check if the double tap to rename files setting is off
            if (App.AppSettings.DoubleTapToRenameFiles == false)
            {
                AllView.CancelEdit();                                                 // cancel the edit operation
                App.CurrentInstance.InteractionOperations.OpenItem_Click(null, null); // open the file instead
                return;
            }

            int extensionLength = SelectedItem.FileExtension?.Length ?? 0;

            oldItemName = SelectedItem.ItemName;

            renamingTextBox = e.EditingElement as TextBox;
            renamingTextBox.Focus(FocusState.Programmatic); // Without this, cannot edit text box when renaming via right-click

            int selectedTextLength = SelectedItem.ItemName.Length;

            if (App.AppSettings.ShowFileExtensions)
            {
                selectedTextLength -= extensionLength;
            }
            renamingTextBox.Select(0, selectedTextLength);
            renamingTextBox.TextChanged += TextBox_TextChanged;
            isRenamingItem = true;
        }
예제 #6
0
 public override void StartRenameItem()
 {
     if (AllView.SelectedIndex != -1)
     {
         AllView.CurrentColumn = AllView.Columns[1];
         AllView.BeginEdit();
     }
 }
예제 #7
0
 protected override void SetSelectedItemOnUi(ListedItem selectedItem)
 {
     // Required to check if sequences are equal, if not it will result in an infinite loop
     // between the UI Control and the BaseLayout set function
     if (AllView.SelectedItem != selectedItem)
     {
         AllView.SelectedItem = selectedItem;
         AllView.UpdateLayout();
     }
 }
예제 #8
0
 private void AllView_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (e != null)
     {
         // Do not commit rename if SelectionChanged is due to selction rectangle (#3660)
         AllView.CommitEdit();
     }
     tapDebounceTimer.Stop();
     SelectedItems = AllView.SelectedItems.Cast <ListedItem>().Where(x => x != null).ToList();
 }
예제 #9
0
        private void AllView_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
        {
            if (ParentShellPageInstance.FilesystemViewModel.WorkingDirectory.StartsWith(AppSettings.RecycleBinPath))
            {
                // Do not rename files and folders inside the recycle bin
                AllView.CancelEdit(); // Cancel the edit operation
                return;
            }

            // Only cancel if this event was triggered by a tap
            // Do not cancel when user presses F2 or context menu
            if (e.EditingEventArgs is TappedRoutedEventArgs)
            {
                if (AppSettings.OpenItemsWithOneclick)
                {
                    AllView.CancelEdit(); // Cancel the edit operation
                    return;
                }

                if (!tapDebounceTimer.IsEnabled)
                {
                    tapDebounceTimer.Debounce(() =>
                    {
                        tapDebounceTimer.Stop();
                        AllView.BeginEdit(); // EditingEventArgs will be null
                    }, TimeSpan.FromMilliseconds(700), false);
                }
                else
                {
                    tapDebounceTimer.Stop();
                    ParentShellPageInstance.InteractionOperations.OpenItem_Click(null, null); // Open selected files
                }

                AllView.CancelEdit(); // Cancel the edit operation
                return;
            }

            int extensionLength = SelectedItem.FileExtension?.Length ?? 0;

            oldItemName = SelectedItem.ItemName;

            renamingTextBox = e.EditingElement as TextBox;
            renamingTextBox.Focus(FocusState.Programmatic); // Without this,the user cannot edit the text box when renaming via right-click

            int selectedTextLength = SelectedItem.ItemName.Length;

            if (AppSettings.ShowFileExtensions)
            {
                selectedTextLength -= extensionLength;
            }
            renamingTextBox.Select(0, selectedTextLength);
            renamingTextBox.TextChanged  += TextBox_TextChanged;
            e.EditingElement.LosingFocus += EditingElement_LosingFocus;
            IsRenamingItem = true;
        }
예제 #10
0
 private void ItemManipulationModel_ScrollIntoViewInvoked(object sender, ListedItem e)
 {
     try
     {
         AllView.ScrollIntoView(e, null);
     }
     catch (Exception)
     {
         // Catch error where row index could not be found
     }
 }
예제 #11
0
 protected override void Page_CharacterReceived(CoreWindow sender, CharacterReceivedEventArgs args)
 {
     if (App.CurrentInstance != null)
     {
         if (App.CurrentInstance.CurrentPageType == typeof(GenericFileBrowser))
         {
             base.Page_CharacterReceived(sender, args);
             AllView.Focus(FocusState.Keyboard);
         }
     }
 }
예제 #12
0
 protected override void Page_CharacterReceived(CoreWindow sender, CharacterReceivedEventArgs args)
 {
     if (App.OccupiedInstance != null)
     {
         if (App.OccupiedInstance.ItemDisplayFrame.SourcePageType == typeof(GenericFileBrowser))
         {
             base.Page_CharacterReceived(sender, args);
             AllView.Focus(FocusState.Keyboard);
         }
     }
 }
예제 #13
0
 public override void ScrollIntoView(ListedItem item)
 {
     try
     {
         AllView.ScrollIntoView(item, null);
     }
     catch (Exception)
     {
         // Catch error where row index could not be found
     }
 }
예제 #14
0
 public override void StartRenameItem()
 {
     try
     {
         AllView.CurrentColumn = AllView.Columns[1];
         AllView.BeginEdit();
     }
     catch (InvalidOperationException)
     {
         // System.InvalidOperationException: There is no current row. Operation cannot be completed.
     }
 }
예제 #15
0
 private void AllView_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     AllView.CommitEdit();
     if (e.AddedItems.Count > 0)
     {
         (App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.HomeItems.isEnabled  = true;
         (App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.ShareItems.isEnabled = true;
     }
     else if (AllView.SelectedItems.Count == 0)
     {
         (App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.HomeItems.isEnabled  = false;
         (App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.ShareItems.isEnabled = false;
     }
 }
예제 #16
0
 private void AllView_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     AllView.CommitEdit();
     if (e.AddedItems.Count > 0)
     {
         tabInstance.HomeItems.isEnabled  = true;
         tabInstance.ShareItems.isEnabled = true;
     }
     else if (data.SelectedItems.Count == 0)
     {
         tabInstance.HomeItems.isEnabled  = false;
         tabInstance.ShareItems.isEnabled = false;
     }
 }
예제 #17
0
 private void ItemManipulationModel_StartRenameItemInvoked(object sender, EventArgs e)
 {
     try
     {
         if (IsItemSelected)
         {
             AllView.CurrentColumn = AllView.Columns[1];
             AllView.BeginEdit();
         }
     }
     catch (InvalidOperationException)
     {
         // System.InvalidOperationException: There is no current row. Operation cannot be completed.
     }
 }
        private void AllView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            AllView.CommitEdit();
            if (e.AddedItems.Count > 0)
            {
                ItemViewModel <GenericFileBrowser> .GetCurrentSelectedTabInstance <ProHome>().HomeItems.isEnabled = true;

                ItemViewModel <GenericFileBrowser> .GetCurrentSelectedTabInstance <ProHome>().ShareItems.isEnabled = true;
            }
            else if (data.SelectedItems.Count == 0)
            {
                ItemViewModel <GenericFileBrowser> .GetCurrentSelectedTabInstance <ProHome>().HomeItems.isEnabled = false;

                ItemViewModel <GenericFileBrowser> .GetCurrentSelectedTabInstance <ProHome>().ShareItems.isEnabled = false;
            }
        }
예제 #19
0
        protected override void Page_CharacterReceived(CoreWindow sender, CharacterReceivedEventArgs args)
        {
            if (App.CurrentInstance != null)
            {
                if (App.CurrentInstance.CurrentPageType == typeof(GenericFileBrowser))
                {
                    var focusedElement = FocusManager.GetFocusedElement(XamlRoot) as FrameworkElement;
                    if (focusedElement is TextBox)
                    {
                        return;
                    }

                    base.Page_CharacterReceived(sender, args);
                    AllView.Focus(FocusState.Keyboard);
                }
            }
        }
예제 #20
0
 private void AllView_PreviewKeyDown(object sender, KeyRoutedEventArgs e)
 {
     if (e.Key == VirtualKey.Enter && !e.KeyStatus.IsMenuKeyDown)
     {
         if (isRenamingItem)
         {
             AllView.CommitEdit();
         }
         else
         {
             App.CurrentInstance.InteractionOperations.List_ItemClick(null, null);
         }
         e.Handled = true;
     }
     else if (e.Key == VirtualKey.Enter && e.KeyStatus.IsMenuKeyDown)
     {
         AssociatedInteractions.ShowPropertiesButton_Click(null, null);
     }
 }
예제 #21
0
        protected override void OnCharacterReceived(CharacterReceivedRoutedEventArgs e)
        {
            if (ParentShellPageInstance != null)
            {
                if (ParentShellPageInstance.CurrentPageType == typeof(GenericFileBrowser))
                {
                    // Don't block the various uses of enter key (key 13)
                    var focusedElement = FocusManager.GetFocusedElement() as FrameworkElement;
                    if (e.Character == (char)13 || focusedElement is Button || focusedElement is TextBox || focusedElement is PasswordBox ||
                        Interaction.FindParent <ContentDialog>(focusedElement) != null)
                    {
                        return;
                    }

                    base.OnCharacterReceived(e);
                    AllView.Focus(FocusState.Keyboard);
                }
            }
        }
예제 #22
0
        protected override void Page_CharacterReceived(CoreWindow sender, CharacterReceivedEventArgs args)
        {
            if (ParentShellPageInstance != null)
            {
                if (ParentShellPageInstance.CurrentPageType == typeof(GenericFileBrowser))
                {
                    // Don't block the various uses of enter key (key 13)
                    var focusedElement = FocusManager.GetFocusedElement() as FrameworkElement;
                    if (args.KeyCode == 13 || focusedElement is Button || focusedElement is TextBox || focusedElement is PasswordBox ||
                        DependencyObjectHelpers.FindParent <ContentDialog>(focusedElement) != null)
                    {
                        return;
                    }

                    base.Page_CharacterReceived(sender, args);
                    AllView.Focus(FocusState.Keyboard);
                }
            }
        }
예제 #23
0
        private void AllView_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
        {
            // Check if the double tap to rename files setting is off
            if (App.AppSettings.DoubleTapToRenameFiles == false)
            {
                AllView.CancelEdit();                                                 // cancel the edit operation
                App.CurrentInstance.InteractionOperations.OpenItem_Click(null, null); // open the file instead
                return;
            }

            var textBox         = e.EditingElement as TextBox;
            var selectedItem    = AllView.SelectedItem as ListedItem;
            int extensionLength = selectedItem.FileExtension?.Length ?? 0;

            previousFileName = selectedItem.ItemName;
            textBox.Focus(FocusState.Programmatic); // Without this, cannot edit text box when renaming via right-click
            textBox.Select(0, selectedItem.ItemName.Length - extensionLength);
            isRenamingItem = true;
        }
예제 #24
0
        private void AllView_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
        {
            if (App.CurrentInstance.FilesystemViewModel.WorkingDirectory.StartsWith(AppSettings.RecycleBinPath))
            {
                // Do not rename files and folders inside the recycle bin
                AllView.CancelEdit(); // Cancel the edit operation
                return;
            }

            // Check if the double tap to rename files setting is off
            if (!AppSettings.DoubleTapToRenameFiles || AppSettings.OpenItemsWithOneclick)
            {
                // Only cancel if this event was triggered by a tap
                // Do not cancel when user presses F2 or context menu
                if (e.EditingEventArgs is TappedRoutedEventArgs)
                {
                    AllView.CancelEdit();                                                     // Cancel the edit operation
                    if (!AppSettings.OpenItemsWithOneclick)                                   // With OpenItemsWithOneclick file will be opened on pointer released
                    {
                        App.CurrentInstance.InteractionOperations.OpenItem_Click(null, null); // Open the file instead
                    }
                    return;
                }
            }

            int extensionLength = SelectedItem.FileExtension?.Length ?? 0;

            oldItemName = SelectedItem.ItemName;

            renamingTextBox = e.EditingElement as TextBox;
            renamingTextBox.Focus(FocusState.Programmatic); // Without this,the user cannot edit the text box when renaming via right-click

            int selectedTextLength = SelectedItem.ItemName.Length;

            if (AppSettings.ShowFileExtensions)
            {
                selectedTextLength -= extensionLength;
            }
            renamingTextBox.Select(0, selectedTextLength);
            renamingTextBox.TextChanged += TextBox_TextChanged;
            isRenamingItem = true;
        }
예제 #25
0
        private void AllView_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
        {
            if (ParentShellPageInstance.FilesystemViewModel.WorkingDirectory.StartsWith(AppSettings.RecycleBinPath))
            {
                // Do not rename files and folders inside the recycle bin
                e.Cancel = true;
                return;
            }

            if (e.EditingEventArgs is TappedRoutedEventArgs)
            {
                // A tap should never trigger an immediate edit
                e.Cancel = true;

                if (AppSettings.OpenItemsWithOneclick || tapDebounceTimer.IsRunning)
                {
                    // If we handle a tap in one-click mode or handling a second tap within a timer duration,
                    // just stop the timer (to avoid extra edits).
                    // The relevant handlers (item pressed / double-click) will kick in and handle this tap
                    tapDebounceTimer.Stop();
                }
                else
                {
                    // We have an edit due to the first tap in the double-click mode
                    // Let's wait to see if there is another tap (double click).

                    tapDebounceTimer.Debounce(() =>
                    {
                        tapDebounceTimer.Stop();

                        AllView.BeginEdit();
                    }, TimeSpan.FromMilliseconds(700), false);
                }
            }
            else
            {
                // If we got here, then the edit is not triggered by tap.
                // We proceed with the edit, and stop the timer to avoid extra edits.
                tapDebounceTimer.Stop();
            }
        }
예제 #26
0
        private void AllView_PreviewKeyDown(object sender, KeyRoutedEventArgs e)
        {
            var ctrlPressed  = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down);
            var shiftPressed = Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down);

            if (e.Key == VirtualKey.Enter && !e.KeyStatus.IsMenuKeyDown)
            {
                if (IsRenamingItem)
                {
                    AllView.CommitEdit();
                }
                else
                {
                    NavigationHelpers.OpenSelectedItems(ParentShellPageInstance, false);
                }
                e.Handled = true;
            }
            else if (e.Key == VirtualKey.Enter && e.KeyStatus.IsMenuKeyDown)
            {
                FilePropertiesHelpers.ShowProperties(ParentShellPageInstance);
                e.Handled = true;
            }
            else if (e.KeyStatus.IsMenuKeyDown && (e.Key == VirtualKey.Left || e.Key == VirtualKey.Right || e.Key == VirtualKey.Up))
            {
                // Unfocus the ListView so keyboard shortcut can be handled
                (ParentShellPageInstance.NavigationToolbar as Control)?.Focus(FocusState.Pointer);
            }
            else if (ctrlPressed && shiftPressed && (e.Key == VirtualKey.Left || e.Key == VirtualKey.Right || e.Key == VirtualKey.W))
            {
                // Unfocus the ListView so keyboard shortcut can be handled (ctrl + shift + W/"->"/"<-")
                (ParentShellPageInstance.NavigationToolbar as Control)?.Focus(FocusState.Pointer);
            }
            else if (e.KeyStatus.IsMenuKeyDown && shiftPressed && e.Key == VirtualKey.Add)
            {
                // Unfocus the ListView so keyboard shortcut can be handled (alt + shift + "+")
                (ParentShellPageInstance.NavigationToolbar as Control)?.Focus(FocusState.Pointer);
            }
        }
예제 #27
0
        private void AllView_PreviewKeyDown(object sender, KeyRoutedEventArgs e)
        {
            var ctrlPressed  = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down);
            var shiftPressed = Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down);

            if (e.Key == VirtualKey.Enter && !e.KeyStatus.IsMenuKeyDown)
            {
                if (IsRenamingItem)
                {
                    AllView.CommitEdit();
                }
                else
                {
                    ParentShellPageInstance.InteractionOperations.OpenItem_Click(null, null);
                }
                e.Handled = true;
            }
            else if (e.Key == VirtualKey.Enter && e.KeyStatus.IsMenuKeyDown)
            {
                ParentShellPageInstance.InteractionOperations.ShowPropertiesButton_Click(null, null);
            }
            else if (e.KeyStatus.IsMenuKeyDown && (e.Key == VirtualKey.Left || e.Key == VirtualKey.Right || e.Key == VirtualKey.Up))
            {
                // Unfocus the ListView so keyboard shortcut can be handled
                Focus(FocusState.Programmatic);
            }
            else if (ctrlPressed && shiftPressed && (e.Key == VirtualKey.Left || e.Key == VirtualKey.Right || e.Key == VirtualKey.W))
            {
                // Unfocus the ListView so keyboard shortcut can be handled (ctrl + shift + W/"->"/"<-")
                Focus(FocusState.Programmatic);
            }
            else if (e.KeyStatus.IsMenuKeyDown && shiftPressed && e.Key == VirtualKey.Add)
            {
                // Unfocus the ListView so keyboard shortcut can be handled (alt + shift + "+")
                Focus(FocusState.Programmatic);
            }
        }
        private async void AllView_CellEditEnded(object sender, DataGridCellEditEndedEventArgs e)
        {
            var newCellText  = (data.SelectedItem as ListedItem)?.FileName;
            var selectedItem = instanceViewModel.FilesAndFolders[e.Row.GetIndex()];

            if (selectedItem.FileType == "Folder")
            {
                StorageFolder FolderToRename = await StorageFolder.GetFolderFromPathAsync(selectedItem.FilePath);

                if (FolderToRename.Name != newCellText)
                {
                    await FolderToRename.RenameAsync(newCellText);

                    AllView.CommitEdit();
                }
                else
                {
                    AllView.CancelEdit();
                }
            }
            else
            {
                StorageFile fileToRename = await StorageFile.GetFileFromPathAsync(selectedItem.FilePath);

                if (fileToRename.Name != newCellText)
                {
                    await fileToRename.RenameAsync(newCellText);

                    AllView.CommitEdit();
                }
                else
                {
                    AllView.CancelEdit();
                }
            }
            //Navigation.NavigationActions.Refresh_Click(null, null);
        }
예제 #29
0
 private void AllView_PreviewKeyDown(object sender, KeyRoutedEventArgs e)
 {
     if (e.Key == VirtualKey.Enter && !e.KeyStatus.IsMenuKeyDown)
     {
         if (IsRenamingItem)
         {
             AllView.CommitEdit();
         }
         else
         {
             ParentShellPageInstance.InteractionOperations.OpenItem_Click(null, null);
         }
         e.Handled = true;
     }
     else if (e.Key == VirtualKey.Enter && e.KeyStatus.IsMenuKeyDown)
     {
         ParentShellPageInstance.InteractionOperations.ShowPropertiesButton_Click(null, null);
     }
     else if (e.KeyStatus.IsMenuKeyDown && (e.Key == VirtualKey.Left || e.Key == VirtualKey.Right || e.Key == VirtualKey.Up))
     {
         // Unfocus the GridView so keyboard shortcut can be handled
         this.Focus(FocusState.Programmatic);
     }
 }
예제 #30
0
 private void AllView_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     AllView.CommitEdit();
     SelectedItems = AllView.SelectedItems.Cast <ListedItem>().ToList();
 }