コード例 #1
0
        private void Cloud_remove_click(object sender, RoutedEventArgs e)
        {
            MenuItem             item   = sender as MenuItem;
            ContextMenuDataModel data   = item.DataContext as ContextMenuDataModel;
            MessageBoxResult     result = System.Windows.MessageBox.Show(this, "Are you want to remove " + data.Type.ToString() + ":" + data.Text, "Confirm", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (result != MessageBoxResult.Yes)
            {
                return;
            }
            if (data.Type == CloudType.Folder || data.Type == CloudType.LocalDisk)
            {
                throw new Exception("Can remove cloud only.");
            }
            if (Setting_UI.reflection_eventtocore.AccountsAndCloud.DeleteAccountCloud(data.Text, data.Type))
            {
                foreach (TreeViewDataModel tv_data in TreeObservableCollection)
                {
                    if (tv_data.DisplayData.Node.Info.Name == data.Text && tv_data.DisplayData.Type == data.Type)
                    {
                        TreeObservableCollection.Remove(tv_data); return;
                    }
                }
            }
        }
コード例 #2
0
        private void Cloud_add_click(object sender, RoutedEventArgs e)
        {
            MenuItem             item = sender as MenuItem;
            ContextMenuDataModel data = item.DataContext as ContextMenuDataModel;

            Setting_UI.reflection_eventtocore.AccountsAndCloud.ShowFormOauth(data.Type);
        }
コード例 #3
0
        private void TV_MenuItem_Click(object sender, RoutedEventArgs e)
        {
            MenuItem menuitem = sender as MenuItem;

            if (menuitem == null)
            {
                return;
            }
            ContextMenuDataModel data_menu = menuitem.DataContext as ContextMenuDataModel;

            if (data_menu == null)
            {
                return;
            }
            switch (data_menu.Key)
            {
            case LanguageKey.TSMI_cut: CutCopy(true); break;

            case LanguageKey.TSMI_copy: CutCopy(false); break;

            case LanguageKey.TSMI_paste: Paste(); break;

            case LanguageKey.TSMI_delete: Delete(); break;

            case LanguageKey.TSMI_downloadsellected: break;

            case LanguageKey.TSMI_uploadfile: break;

            case LanguageKey.TSMI_uploadfolder: break;

            default: return;
            }
        }
コード例 #4
0
        private void TV_MenuItem_Click(object sender, RoutedEventArgs e)
        {
            MenuItem             menu  = sender as MenuItem;
            ContextMenuDataModel model = menu.DataContext as ContextMenuDataModel;

            if (model != null && model.Key == LanguageKey.TSMI_numberOfParallelDownloads)
            {
                ChangeNumberOfParallelDownloads();
            }
            else
            {
                switch (model.Key)
                {
                case LanguageKey.TSMI_start: ChangeStatus(StatusTransfer.Started); break;

                case LanguageKey.TSMI_waiting: ChangeStatus(StatusTransfer.Waiting); break;

                case LanguageKey.TSMI_stop: ChangeStatus(StatusTransfer.Stop); break;

                case LanguageKey.TSMI_remove:
                    MessageBoxResult result = MessageBox.Show("Are you sure to remove?", "Confirm", MessageBoxButton.YesNo, MessageBoxImage.Question);
                    if (result == MessageBoxResult.Yes)
                    {
                        ChangeStatus(StatusTransfer.Remove);
                    }
                    break;

                case LanguageKey.TSMI_forcestart: ErrorSetForce(StatusTransfer.Started); break;

                case LanguageKey.TSMI_forcewaiting: ErrorSetForce(StatusTransfer.Waiting); break;
                }
            }
            groups.Clear();
            items.Clear();
        }
コード例 #5
0
        private void ChangeLang_click(object sender, RoutedEventArgs e)
        {
            MenuItem             item = sender as MenuItem;
            ContextMenuDataModel data = item.DataContext as ContextMenuDataModel;

            Setting_UI.reflection_eventtocore.SettingAndLanguage.SetSetting(SettingsKey.lang, data.Text);
            Setting_UI.reflection_eventtocore.SettingAndLanguage.SaveSetting();
            LoadLanguage();
        }
コード例 #6
0
        private void ChangeUI_click(object sender, RoutedEventArgs e)
        {
            MenuItem             item = sender as MenuItem;
            ContextMenuDataModel data = item.DataContext as ContextMenuDataModel;

            Setting_UI.reflection_eventtocore.SettingAndLanguage.SetSetting(SettingsKey.UI_dll_file, data.Text);
            Setting_UI.reflection_eventtocore.SettingAndLanguage.SaveSetting();
            Setting_UI.ReloadUI_Flag = true;
            this.Close();
        }
コード例 #7
0
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Controls.MenuItem menuitem = sender as System.Windows.Controls.MenuItem;
            if (menuitem != null && menuitem.Header != null && menuitem.DataContext is ContextMenuDataModel)
            {
                ContextMenuDataModel menu_data_blind = menuitem.DataContext as ContextMenuDataModel;
                switch (menu_data_blind.Key)
                {
                case LanguageKey.TSMI_refresh: ExplorerCurrentNode(); return;

                case LanguageKey.TSMI_open: OpenItemLV(); return;

                case LanguageKey.TSMI_cut: CutCopy(true); return;

                case LanguageKey.TSMI_copy: CutCopy(false); return;

                case LanguageKey.TSMI_paste: Paste(); return;

                case LanguageKey.TSMI_rename: Rename(); return;

                case LanguageKey.TSMI_delete: Delete(); return;

                case LanguageKey.TSMI_createfolder: CreateFolder(); return;

                case LanguageKey.TSMI_copyid: System.Windows.Clipboard.SetText((LV_items.SelectedItem as LV_data).Node.Info.ID); return;

                case LanguageKey.TSMI_downloadsellected: DownloadSelected(); return;

                case LanguageKey.TSMI_uploadfolder: uploadfolder(); return;

                case LanguageKey.TSMI_uploadfile: uploadfile(); return;

                default: throw new Exception("Not found MenuItem: " + menu_data_blind.Key.ToString());
                }
            }
        }
コード例 #8
0
        void Load_TLVmenu()
        {
            menuitems_source          = new ObservableCollection <ContextMenuDataModel>();
            change                    = new ContextMenuDataModel(LanguageKey.TSMI_ChangeStatus);
            start                     = new ContextMenuDataModel(LanguageKey.TSMI_start);
            waiting                   = new ContextMenuDataModel(LanguageKey.TSMI_waiting);
            stop                      = new ContextMenuDataModel(LanguageKey.TSMI_stop);
            error                     = new ContextMenuDataModel(LanguageKey.TSMI_error);
            remove                    = new ContextMenuDataModel(LanguageKey.TSMI_remove);
            numberOfParallelDownloads = new ContextMenuDataModel(LanguageKey.TSMI_numberOfParallelDownloads);

            change.Child.Add(start);
            change.Child.Add(waiting);
            change.Child.Add(stop);
            change.Child.Add(error);

            error.Child.Add(new ContextMenuDataModel(LanguageKey.TSMI_forcestart));
            error.Child.Add(new ContextMenuDataModel(LanguageKey.TSMI_forcewaiting));
            menuitems_source.Add(change);
            menuitems_source.Add(numberOfParallelDownloads);
            menuitems_source.Add(null);
            menuitems_source.Add(remove);
            treeList.ContextMenu.ItemsSource = menuitems_source;
        }