Пример #1
0
 public ImageListViewItem(string[] items, ImageDictionary imageDictionary, string imageKey)
     : base(items, imageKey)
 {
     this.imageDict = imageDictionary;
     this.imageUrl = imageKey;
     var dummy = this.GetImage( false );
 }
Пример #2
0
        public ImageBuffer()
        {
            images          = new ImageDictionary();
            thumbNailImages = new ImageDictionary();

            this.UpdatedSubject = new Subject <string>().AddTo(this.Disposables);

            this.ActionQueueSubject = new Subject <Unit>().AddTo(this.Disposables);

            var scheduler = new EventLoopScheduler();

            //読み込み要求を処理
            var subscription = this.ActionQueueSubject
                               .ObserveOn(scheduler)
                               .Subscribe(async _ =>
            {
                CommandPacket packet;
                while (this.currentFileLoadRequest.TryDequeue(mainQueueCapacity, out packet) ||
                       this.lowQualityPreLoadRequest.TryDequeue(lowQueueCapacity, out packet) ||
                       this.highQualityPreLoadRequest.TryDequeue(preloadQueueCapacity, out packet) ||
                       this.thumbNailLoadRequest.TryDequeue(this.ThumbnailRequestCapacity, out packet))
                {
                    await this.LoadImageAsync(packet).ConfigureAwait(false);
                }
            });

            Disposable.Create(() =>
            {
                subscription.Dispose();
                scheduler.Dispose();
            }).AddTo(this.Disposables);
        }
Пример #3
0
 public ImageListViewItem(string[] items, ImageDictionary imageDictionary, string imageKey)
     : base(items, imageKey)
 {
     _images = imageDictionary;
     _imageUrl = imageKey;
     GetImage(false);
 }
Пример #4
0
        public void GetRandomWrongImage()
        {
            ImageDictionary imgDict = new ImageDictionary();
            var             img     = imgDict.GetRandomWrongImage(TypesOfImages.Flower);

            Assert.AreNotEqual(img, null);
        }
Пример #5
0
        public void GetImageListFromPattern()
        {
            var expected = new List <Image>();

            ImageDictionary imgDict = new ImageDictionary();
            var             imgList = imgDict.GetImageListFromPattern(TypesOfImages.Flower);

            Assert.AreNotEqual(imgList.Count, 0);
        }
        /// <summary>
        /// Reports success and tries to generate data index file.
        /// </summary>
        private void exportFinished(
            OpenNIRecordingController sender,
            DirectoryInfo exportDir, List<int> frames, List<int> userIDs,
            ImageDictionary exportedFiles2D,
            ImageDictionary exportedFiles3D, bool ExportRelativePathNames,
            String export_filename_suffix)
        {
            // Report success.
            lazyInvoke((MethodInvoker)delegate
            {
                exportForm.textBoxProgress.Text =
                    "Exporting images finished. Generating data index file...";
            });

            try
            {
                if (exportedFiles2D != null)
                {
                    using (FileStream write_to = File.OpenWrite(
                        Path.Combine(exportDir.FullName, "Export2D" + export_filename_suffix + ".xml")))
                    {
                        movementDataSerializer.Serialize(write_to, exportedFiles2D);
                    }
                }
                if (exportedFiles3D != null)
                {
                    using (FileStream write_to = File.OpenWrite(
                        Path.Combine(exportDir.FullName, "Export3D" + export_filename_suffix + ".xml")))
                    {
                        movementDataSerializer.Serialize(write_to, exportedFiles3D);
                    }
                }
            }
            catch (Exception e)
            {
                showException("Error creating data index file: \n" +
                    e.Message);
            }

            // Report success.
            lazyInvoke((MethodInvoker)delegate
            {
                exportForm.Hide();
                textBoxExport.Text = "Last export successful to folder " + exportDir.FullName;
            });

            sender.ResetExportEventHandlers();
        }
        /// <summary>
        /// Reconfigures the exporting parameters and starts the third part
        /// of the batch export.
        /// </summary>
        private void batchExportPart2Finished(
            OpenNIRecordingController sender,
            DirectoryInfo exportDir, List<int> frames, List<int> userIDs,
            ImageDictionary exportedFiles2D,
            ImageDictionary exportedFiles3D, bool ExportRelativePathNames,
            String export_filename_suffix)
        {
            // Report success.
            lazyInvoke((MethodInvoker)delegate
            {
                exportForm.textBoxProgress.Text =
                    "Exporting images with skeleton finished (Batch export part 2)." +
                    "Generating data index file...";
            });

            try
            {
                if (exportedFiles2D != null)
                {
                    using (FileStream write_to = File.OpenWrite(
                        Path.Combine(exportDir.FullName, "Export2D" + export_filename_suffix + ".xml")))
                    {
                        movementDataSerializer.Serialize(write_to, exportedFiles2D);
                    }
                }
                if (exportedFiles3D != null)
                {
                    using (FileStream write_to = File.OpenWrite(
                        Path.Combine(exportDir.FullName, "Export3D" + export_filename_suffix + ".xml")))
                    {
                        movementDataSerializer.Serialize(write_to, exportedFiles3D);
                    }
                }
            }
            catch (Exception e)
            {
                showException("Error creating data index file: \n" +
                    e.Message);
            }

            // Configure for the second export.
            // Check whether the user selected to do a batch export.
            OpenNIRecordingController exportVideo = sender;
            exportVideo.ExportFinished -= batchExportPart2Finished;
            exportVideo.ExportFinished += exportFinished;

            // Reset progress bar.
            lazyInvoke((MethodInvoker)delegate
                 {
                     exportForm.progressBar.Value = 0;
                     exportForm.textBoxProgress.Text = "Initializing batch export part 3...";
                 });

            // Begin exporting.
            exportVideo.ExportFrames(
                frames,
                userIDs,
                (exportedFiles2D != null),
                (exportedFiles3D != null),
                ExportRelativePathNames,
                true, false, false, false, false,
                exportDir);
        }
Пример #8
0
        public async Task InitDb(string path)
        {
            IDataResult <IBaseEntityCategory> dataResult = _normalizeData.Normalize(path);

            return;

            if (!dataResult.Success)
            {
                return;
            }

            IBaseEntityCategory excelProcessingEntity = dataResult.Data;

            foreach (KeyValuePair <ITranslationEntity, IParsedResultEntity> parsedResultEntity in
                     excelProcessingEntity.Categotis)
            {
                string fullName =
                    LanguageHolder.GetLanguage(parsedResultEntity.Key.Language);

                if (fullName != null)
                {
                    await AppendLangDictionary(parsedResultEntity.Key.Language, fullName);

                    IDataResult <int> checkCategoryExistResult =
                        await CheckCategoryExist(parsedResultEntity.Key);

                    int categoryId;

                    if (checkCategoryExistResult.Success)
                    {
                        categoryId = checkCategoryExistResult.Data;
                    }
                    else
                    {
                        var category = new Category()
                        {
                            ImgPath = ""
                        };

                        await _categoryRepository.AddAsync(category);

                        await _categoryRepository.SaveAsync();

                        categoryId = category.Id;
                    }

                    IDataResult <List <string> > existingLanguageResult =
                        await CheckLanguagesExists(categoryId);

                    List <string> existingLanguage = existingLanguageResult.Data;

                    if (existingLanguage != null &&
                        existingLanguage.All(p => p != parsedResultEntity.Key.Language))
                    {
                        await _categoryTranslationRepository.AddAsync(new CategoryTranslation()
                        {
                            CategoryId        = categoryId,
                            IsMainTranslation = true,
                            LangDictionaryId  = parsedResultEntity.Key.Language,
                            CategoryName      = parsedResultEntity.Key.Value
                        });

                        await _categoryTranslationRepository.SaveAsync();
                    }

                    foreach (ITranslationEntity translationEntity in parsedResultEntity.Value.CategoryTranslate)
                    {
                        if (existingLanguage != null &&
                            //existingLanguage.Any() &&
                            existingLanguage.All(p => p != translationEntity.Language))
                        {
                            await _categoryTranslationRepository.AddAsync(new CategoryTranslation()
                            {
                                CategoryId        = categoryId,
                                IsMainTranslation = false,
                                LangDictionaryId  = translationEntity.Language,
                                CategoryName      = translationEntity.Value
                            });

                            await _categoryTranslationRepository.SaveAsync();
                        }
                    }


                    //проверь сдесь значения на налл Вордтранслейшен именно я пока курить

                    IDataResult <int> checImageDictionaryExistResult = new DataResult <int>();

                    if (parsedResultEntity.Value?.ItemEntity?.MainSection?.WordTranslation != null)
                    {
                        checImageDictionaryExistResult =
                            await CheckImgDictionaryExist(parsedResultEntity.Value.ItemEntity.MainSection
                                                          .WordTranslation);

                        int imagDictionaryId;

                        if (checImageDictionaryExistResult.Success)
                        {
                            imagDictionaryId = checkCategoryExistResult.Data;
                        }
                        else
                        {
                            var imageDictionary = new ImageDictionary()
                            {
                                DisplayAtProgram = true,
                                CategoryId       = categoryId,
                                RootImageId      = null
                            };

                            await _imageDictionaryRepository.AddAsync(imageDictionary);

                            await _imageDictionaryRepository.SaveAsync();

                            imagDictionaryId = imageDictionary.Id;
                        }

                        IDataResult <List <string> > existingImageLanguageResult =
                            await CheckImageLanguagesExists(imagDictionaryId);

                        List <string> existingImgLangs = existingImageLanguageResult.Data;

                        if (parsedResultEntity.Value?.ItemEntity?.MainSection?.WordTranslation != null)
                        {
                            fullName =
                                LanguageHolder.GetLanguage(parsedResultEntity.Value.ItemEntity.MainSection
                                                           .WordTranslation
                                                           .Language);

                            //if (fullName != null)
                            //{
                            //    await AppendLangDictionary(
                            //        parsedResultEntity.Value.ItemEntity.MainSection.WordTranslation.Language, fullName);
                            //    if (existingImgLangs != null &&
                            //        existingImgLangs.All(p =>
                            //            p != parsedResultEntity.Value.ItemEntity.MainSection.WordTranslation.Language))
                            //    {
                            //        var mainImageDescriptionItem =
                            //            parsedResultEntity.Value.ItemEntity.MainSection;
                            //        await _imageDescriptionRepository.AddAsync(new ImageDescription()
                            //        {
                            //            ImageDictionaryId = imagDictionaryId,
                            //            IsMainTranslation = true,
                            //            LangDictionaryId = mainImageDescriptionItem.WordTranslation.Language,
                            //            Description = mainImageDescriptionItem.WordTranslation.Value
                            //        });

                            //        await _imageDescriptionRepository.SaveAsync();
                            //    }
                            //}

                            foreach (var imgDictionaryItem in parsedResultEntity.Value.ItemEntity.TranslationItemEntitys)
                            {
                                ImageDictionary itemForUpdate =
                                    await _imageDictionaryRepository.GetByIdAsync(imagDictionaryId);

                                itemForUpdate.SexType = imgDictionaryItem.SexType;
                                await _imageDictionaryRepository.UpdateAsync(itemForUpdate);

                                await _imageDictionaryRepository.SaveAsync();

                                foreach (ITranslationEntity translationEntity in imgDictionaryItem.WordTranslations)
                                {
                                    fullName =
                                        LanguageHolder.GetLanguage(translationEntity.Language);
                                    if (fullName != null)
                                    {
                                        await AppendLangDictionary(
                                            translationEntity.Language, fullName);

                                        if (existingImgLangs != null &&
                                            existingImgLangs.All(p =>
                                                                 p != translationEntity.Language)
                                            )
                                        {
                                            if (translationEntity.Language != parsedResultEntity.Value.ItemEntity
                                                .MainSection.WordTranslation.Language)
                                            {
                                                await _imageDescriptionRepository.AddAsync(new ImageDescription()
                                                {
                                                    ImageDictionaryId = imagDictionaryId,
                                                    IsMainTranslation = false,
                                                    LangDictionaryId  = translationEntity.Language,
                                                    Description       = translationEntity.Value
                                                });
                                            }
                                            else
                                            {
                                                await _imageDescriptionRepository.AddAsync(new ImageDescription()
                                                {
                                                    ImageDictionaryId = imagDictionaryId,
                                                    IsMainTranslation = true,
                                                    LangDictionaryId  = translationEntity.Language,
                                                    Description       = translationEntity.Value
                                                });
                                            }

                                            await _imageDescriptionRepository.SaveAsync();
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #9
0
        private void TweenMain_LoadExtracted()
        {
            _ignoreConfigSave = true;
            Visible = false;
            VerUpMenuItem.Image = _shield.Icon;
            _spaceKeyCanceler = new SpaceKeyCanceler(PostButton);
            _spaceKeyCanceler.SpaceCancel += SpaceKeyCanceler_SpaceCancel;

            Regex.CacheSize = 100;

            InitializeTraceFrag();

            _statuses = TabInformations.Instance; // 発言保持クラス

            // アイコン設定
            LoadIcons();                        // アイコン読み込み
            Icon = _mainIcon;               // メインフォーム(TweenMain)
            NotifyIcon1.Icon = _iconAt;     // タスクトレイ
            TabImage.Images.Add(_tabIcon);  // タブ見出し

            _settingDialog.Owner = this;
            _searchDialog.Owner = this;
            _fltDialog.Owner = this;
            _tabDialog.Owner = this;
            _urlDialog.Owner = this;

            _postHistory.Add(new PostingStatus());
            _postHistoryIndex = 0;

            ClearReplyToInfo();

            // <<<<<<<<<設定関連>>>>>>>>>
            // '設定読み出し
            LoadConfig();

            // 新着バルーン通知のチェック状態設定
            NewPostPopMenuItem.Checked = _cfgCommon.NewAllPop;
            NotifyFileMenuItem.Checked = _cfgCommon.NewAllPop;

            // フォント&文字色&背景色保持
            _fntUnread = _cfgLocal.FontUnread;
            _clrUnread = _cfgLocal.ColorUnread;
            _fntReaded = _cfgLocal.FontRead;
            _clrRead = _cfgLocal.ColorRead;
            _clrFav = _cfgLocal.ColorFav;
            _clrOwl = _cfgLocal.ColorOwl;
            _clrRetweet = _cfgLocal.ColorRetweet;
            _fntDetail = _cfgLocal.FontDetail;
            _clrDetail = _cfgLocal.ColorDetail;
            _clrDetailLink = _cfgLocal.ColorDetailLink;
            _clrDetailBackcolor = _cfgLocal.ColorDetailBackcolor;
            _clrSelf = _cfgLocal.ColorSelf;
            _clrAtSelf = _cfgLocal.ColorAtSelf;
            _clrTarget = _cfgLocal.ColorTarget;
            _clrAtTarget = _cfgLocal.ColorAtTarget;
            _clrAtFromTarget = _cfgLocal.ColorAtFromTarget;
            _clrAtTo = _cfgLocal.ColorAtTo;
            _clrListBackcolor = _cfgLocal.ColorListBackcolor;
            InputBackColor = _cfgLocal.ColorInputBackcolor;
            _clrInputForecolor = _cfgLocal.ColorInputFont;
            _fntInputFont = _cfgLocal.FontInputFont;

            InitUserBrushes();

            // StringFormatオブジェクトへの事前設定
            _tabStringFormat.Alignment = StringAlignment.Center;
            _tabStringFormat.LineAlignment = StringAlignment.Center;

            // 設定画面への反映
            HttpTwitter.SetTwitterUrl(_cfgCommon.TwitterUrl);
            _configs.TwitterApiUrl = _cfgCommon.TwitterUrl;
            _configs.TwitterSearchApiUrl = _cfgCommon.TwitterSearchUrl;

            // 認証関連
            if (string.IsNullOrEmpty(_cfgCommon.Token))
            {
                _cfgCommon.UserName = string.Empty;
            }

            _tw.Initialize(_cfgCommon.Token, _cfgCommon.TokenSecret, _cfgCommon.UserName, _cfgCommon.UserId);

            _configs.UserAccounts = _cfgCommon.UserAccounts;
            _configs.TimelinePeriodInt = _cfgCommon.TimelinePeriod;
            _configs.ReplyPeriodInt = _cfgCommon.ReplyPeriod;
            _configs.DMPeriodInt = _cfgCommon.DMPeriod;
            _configs.PubSearchPeriodInt = _cfgCommon.PubSearchPeriod;
            _configs.UserTimelinePeriodInt = _cfgCommon.UserTimelinePeriod;
            _configs.ListsPeriodInt = _cfgCommon.ListsPeriod;

            // 不正値チェック
            if (!MyCommon.NoLimit)
            {
                if (_configs.TimelinePeriodInt < 15 && _configs.TimelinePeriodInt > 0)
                {
                    _configs.TimelinePeriodInt = 15;
                }

                if (_configs.ReplyPeriodInt < 15 && _configs.ReplyPeriodInt > 0)
                {
                    _configs.ReplyPeriodInt = 15;
                }

                if (_configs.DMPeriodInt < 15 && _configs.DMPeriodInt > 0)
                {
                    _configs.DMPeriodInt = 15;
                }

                if (_configs.PubSearchPeriodInt < 30 && _configs.PubSearchPeriodInt > 0)
                {
                    _configs.PubSearchPeriodInt = 30;
                }

                if (_configs.UserTimelinePeriodInt < 15 && _configs.UserTimelinePeriodInt > 0)
                {
                    _configs.UserTimelinePeriodInt = 15;
                }

                if (_configs.ListsPeriodInt < 15 && _configs.ListsPeriodInt > 0)
                {
                    _configs.ListsPeriodInt = 15;
                }
            }

            // 起動時読み込み分を既読にするか。Trueなら既読として処理
            _configs.Readed = _cfgCommon.Read;

            // 新着取得時のリストスクロールをするか。Trueならスクロールしない
            ListLockMenuItem.Checked = _cfgCommon.ListLock;
            LockListFileMenuItem.Checked = _cfgCommon.ListLock;
            _configs.IconSz = _cfgCommon.IconSize;

            // 文末ステータス
            _configs.Status = _cfgLocal.StatusText;

            // 未読管理。Trueなら未読管理する
            _configs.UnreadManage = _cfgCommon.UnreadManage;

            // サウンド再生(タブ別設定より優先)
            _configs.PlaySound = _cfgCommon.PlaySound;
            PlaySoundMenuItem.Checked = _configs.PlaySound;
            PlaySoundFileMenuItem.Checked = _configs.PlaySound;

            // 片思い表示。Trueなら片思い表示する
            _configs.OneWayLove = _cfgCommon.OneWayLove;

            // フォント&文字色&背景色
            _configs.FontUnread = _fntUnread;
            _configs.ColorUnread = _clrUnread;
            _configs.FontReaded = _fntReaded;
            _configs.ColorReaded = _clrRead;
            _configs.ColorFav = _clrFav;
            _configs.ColorOWL = _clrOwl;
            _configs.ColorRetweet = _clrRetweet;
            _configs.FontDetail = _fntDetail;
            _configs.ColorDetail = _clrDetail;
            _configs.ColorDetailLink = _clrDetailLink;
            _configs.ColorDetailBackcolor = _clrDetailBackcolor;
            _configs.ColorSelf = _clrSelf;
            _configs.ColorAtSelf = _clrAtSelf;
            _configs.ColorTarget = _clrTarget;
            _configs.ColorAtTarget = _clrAtTarget;
            _configs.ColorAtFromTarget = _clrAtFromTarget;
            _configs.ColorAtTo = _clrAtTo;
            _configs.ColorListBackcolor = _clrListBackcolor;
            _configs.ColorInputBackcolor = InputBackColor;
            _configs.ColorInputFont = _clrInputForecolor;
            _configs.FontInputFont = _fntInputFont;
            _configs.NameBalloon = _cfgCommon.NameBalloon;
            _configs.PostCtrlEnter = _cfgCommon.PostCtrlEnter;
            _configs.PostShiftEnter = _cfgCommon.PostShiftEnter;
            _configs.CountApi = _cfgCommon.CountApi;
            _configs.CountApiReply = _cfgCommon.CountApiReply;
            if (_configs.CountApi < 20 || _configs.CountApi > 200)
            {
                _configs.CountApi = 60;
            }

            if (_configs.CountApiReply < 20 || _configs.CountApiReply > 200)
            {
                _configs.CountApiReply = 40;
            }

            _configs.BrowserPath = _cfgLocal.BrowserPath;
            _configs.PostAndGet = _cfgCommon.PostAndGet;
            _configs.UseRecommendStatus = _cfgLocal.UseRecommendStatus;
            _configs.DispUsername = _cfgCommon.DispUsername;
            _configs.CloseToExit = _cfgCommon.CloseToExit;
            _configs.MinimizeToTray = _cfgCommon.MinimizeToTray;
            _configs.DispLatestPost = _cfgCommon.DispLatestPost;
            _configs.SortOrderLock = _cfgCommon.SortOrderLock;
            _configs.TinyUrlResolve = _cfgCommon.TinyUrlResolve;
            _configs.ShortUrlForceResolve = _cfgCommon.ShortUrlForceResolve;
            _configs.SelectedProxyType = _cfgLocal.ProxyType;
            _configs.ProxyAddress = _cfgLocal.ProxyAddress;
            _configs.ProxyPort = _cfgLocal.ProxyPort;
            _configs.ProxyUser = _cfgLocal.ProxyUser;
            _configs.ProxyPassword = _cfgLocal.ProxyPassword;
            _configs.PeriodAdjust = _cfgCommon.PeriodAdjust;
            _configs.StartupVersion = _cfgCommon.StartupVersion;
            _configs.StartupFollowers = _cfgCommon.StartupFollowers;
            _configs.RestrictFavCheck = _cfgCommon.RestrictFavCheck;
            _configs.AlwaysTop = _cfgCommon.AlwaysTop;
            _configs.UrlConvertAuto = false;
            _configs.OutputzEnabled = _cfgCommon.Outputz;
            _configs.OutputzKey = _cfgCommon.OutputzKey;
            _configs.OutputzUrlmode = _cfgCommon.OutputzUrlMode;
            _configs.UseUnreadStyle = _cfgCommon.UseUnreadStyle;
            _configs.DefaultTimeOut = _cfgCommon.DefaultTimeOut;
            _configs.RetweetNoConfirm = _cfgCommon.RetweetNoConfirm;
            _configs.PlaySound = _cfgCommon.PlaySound;
            _configs.DateTimeFormat = _cfgCommon.DateTimeFormat;
            _configs.LimitBalloon = _cfgCommon.LimitBalloon;
            _configs.EventNotifyEnabled = _cfgCommon.EventNotifyEnabled;
            _configs.EventNotifyFlag = _cfgCommon.EventNotifyFlag;
            _configs.IsMyEventNotifyFlag = _cfgCommon.IsMyEventNotifyFlag;
            _configs.ForceEventNotify = _cfgCommon.ForceEventNotify;
            _configs.FavEventUnread = _cfgCommon.FavEventUnread;
            _configs.TranslateLanguage = _cfgCommon.TranslateLanguage;
            _configs.EventSoundFile = _cfgCommon.EventSoundFile;

            // 廃止サービスが選択されていた場合bit.lyへ読み替え
            if (_cfgCommon.AutoShortUrlFirst < 0)
            {
                _cfgCommon.AutoShortUrlFirst = UrlConverter.Bitly;
            }

            _configs.AutoShortUrlFirst = _cfgCommon.AutoShortUrlFirst;
            _configs.TabIconDisp = _cfgCommon.TabIconDisp;
            _configs.ReplyIconState = _cfgCommon.ReplyIconState;
            _configs.ReadOwnPost = _cfgCommon.ReadOwnPost;
            _configs.GetFav = _cfgCommon.GetFav;
            _configs.ReadOldPosts = _cfgCommon.ReadOldPosts;
            _configs.UseSsl = _cfgCommon.UseSsl;
            _configs.BitlyUser = _cfgCommon.BilyUser;
            _configs.BitlyPwd = _cfgCommon.BitlyPwd;
            _configs.ShowGrid = _cfgCommon.ShowGrid;
            _configs.Language = _cfgCommon.Language;
            _configs.UseAtIdSupplement = _cfgCommon.UseAtIdSupplement;
            _configs.UseHashSupplement = _cfgCommon.UseHashSupplement;
            _configs.PreviewEnable = _cfgCommon.PreviewEnable;
            AtIdSupl = new AtIdSupplement(SettingAtIdList.Load().AtIdList, "@");

            _configs.IsMonospace = _cfgCommon.IsMonospace;
            _detailHtmlFormatFooter = GetDetailHtmlFormatFooter(_configs.IsMonospace);
            _detailHtmlFormatHeader = GetDetailHtmlFormatHeader(_configs.IsMonospace);

            IdeographicSpaceToSpaceToolStripMenuItem.Checked = _cfgCommon.WideSpaceConvert;
            ToolStripFocusLockMenuItem.Checked = _cfgCommon.FocusLockToStatusText;

            _configs.RecommendStatusText = " [HH2v" + Regex.Replace(MyCommon.FileVersion.Replace(".", string.Empty), "^0*", string.Empty) + "]";

            // 書式指定文字列エラーチェック
            try
            {
                if (DateTime.Now.ToString(_configs.DateTimeFormat).Length == 0)
                {
                    // このブロックは絶対に実行されないはず
                    // 変換が成功した場合にLengthが0にならない
                    _configs.DateTimeFormat = "yyyy/MM/dd H:mm:ss";
                }
            }
            catch (FormatException)
            {
                // FormatExceptionが発生したら初期値を設定 (=yyyy/MM/dd H:mm:ssとみなされる)
                _configs.DateTimeFormat = "yyyy/MM/dd H:mm:ss";
            }

            _configs.Nicoms = _cfgCommon.Nicoms;
            _configs.HotkeyEnabled = _cfgCommon.HotkeyEnabled;
            _configs.HotkeyMod = _cfgCommon.HotkeyModifier;
            _configs.HotkeyKey = _cfgCommon.HotkeyKey;
            _configs.HotkeyValue = _cfgCommon.HotkeyValue;
            _configs.BlinkNewMentions = _cfgCommon.BlinkNewMentions;
            _configs.UseAdditionalCount = _cfgCommon.UseAdditionalCount;
            _configs.MoreCountApi = _cfgCommon.MoreCountApi;
            _configs.FirstCountApi = _cfgCommon.FirstCountApi;
            _configs.SearchCountApi = _cfgCommon.SearchCountApi;
            _configs.FavoritesCountApi = _cfgCommon.FavoritesCountApi;
            _configs.UserTimelineCountApi = _cfgCommon.UserTimelineCountApi;
            _configs.ListCountApi = _cfgCommon.ListCountApi;
            _configs.UserstreamStartup = _cfgCommon.UserstreamStartup;
            _configs.UserstreamPeriodInt = _cfgCommon.UserstreamPeriod;
            _configs.OpenUserTimeline = _cfgCommon.OpenUserTimeline;
            _configs.ListDoubleClickAction = _cfgCommon.ListDoubleClickAction;
            _configs.UserAppointUrl = _cfgCommon.UserAppointUrl;
            _configs.HideDuplicatedRetweets = _cfgCommon.HideDuplicatedRetweets;
            _configs.IsPreviewFoursquare = _cfgCommon.IsPreviewFoursquare;
            _configs.FoursquarePreviewHeight = _cfgCommon.FoursquarePreviewHeight;
            _configs.FoursquarePreviewWidth = _cfgCommon.FoursquarePreviewWidth;
            _configs.FoursquarePreviewZoom = _cfgCommon.FoursquarePreviewZoom;
            _configs.IsListStatusesIncludeRts = _cfgCommon.IsListsIncludeRts;
            _configs.TabMouseLock = _cfgCommon.TabMouseLock;
            _configs.IsRemoveSameEvent = _cfgCommon.IsRemoveSameEvent;
            _configs.IsNotifyUseGrowl = _cfgCommon.IsUseNotifyGrowl;

            // ハッシュタグ関連
            HashSupl = new AtIdSupplement(_cfgCommon.HashTags, "#");
            HashMgr = new HashtagManage(HashSupl, _cfgCommon.HashTags.ToArray(), _cfgCommon.HashSelected, _cfgCommon.HashIsPermanent, _cfgCommon.HashIsHead, _cfgCommon.HashIsNotAddToAtReply);
            if (!string.IsNullOrEmpty(HashMgr.UseHash) && HashMgr.IsPermanent)
            {
                HashStripSplitButton.Text = HashMgr.UseHash;
            }

            _isInitializing = true;

            // アイコンリスト作成
            try
            {
                _iconDict = new ImageDictionary(5);
            }
            catch (Exception)
            {
                MessageBox.Show("Please install [.NET Framework 4 (Full)].");
                Application.Exit();
                return;
            }

            _iconDict.PauseGetImage = false;

            bool saveRequired = false;

            // ユーザー名、パスワードが未設定なら設定画面を表示(初回起動時など)
            if (string.IsNullOrEmpty(_tw.Username))
            {
                saveRequired = true;

                // 設定せずにキャンセルされた場合はプログラム終了
                if (_settingDialog.ShowDialog(this) == DialogResult.Cancel)
                {
                    // 強制終了
                    Application.Exit();
                    return;
                }

                // 設定されたが、依然ユーザー名とパスワードが未設定ならプログラム終了
                if (string.IsNullOrEmpty(_tw.Username))
                {
                    // 強制終了
                    Application.Exit();
                    return;
                }

                // フォント&文字色&背景色保持
                _fntUnread = _configs.FontUnread;
                _clrUnread = _configs.ColorUnread;
                _fntReaded = _configs.FontReaded;
                _clrRead = _configs.ColorReaded;
                _clrFav = _configs.ColorFav;
                _clrOwl = _configs.ColorOWL;
                _clrRetweet = _configs.ColorRetweet;
                _fntDetail = _configs.FontDetail;
                _clrDetail = _configs.ColorDetail;
                _clrDetailLink = _configs.ColorDetailLink;
                _clrDetailBackcolor = _configs.ColorDetailBackcolor;
                _clrSelf = _configs.ColorSelf;
                _clrAtSelf = _configs.ColorAtSelf;
                _clrTarget = _configs.ColorTarget;
                _clrAtTarget = _configs.ColorAtTarget;
                _clrAtFromTarget = _configs.ColorAtFromTarget;
                _clrAtTo = _configs.ColorAtTo;
                _clrListBackcolor = _configs.ColorListBackcolor;
                InputBackColor = _configs.ColorInputBackcolor;
                _clrInputForecolor = _configs.ColorInputFont;
                _fntInputFont = _configs.FontInputFont;
                DisposeUserBrushes();
                InitUserBrushes();
                _detailHtmlFormatFooter = GetDetailHtmlFormatFooter(_configs.IsMonospace);
                _detailHtmlFormatHeader = GetDetailHtmlFormatHeader(_configs.IsMonospace);
            }

            if (_configs.HotkeyEnabled)
            {
                // グローバルホットキーの登録
                var modKey = HookGlobalHotkey.ModKeys.None;
                if ((_configs.HotkeyMod & Keys.Alt) == Keys.Alt)
                {
                    modKey = modKey | HookGlobalHotkey.ModKeys.Alt;
                }

                if ((_configs.HotkeyMod & Keys.Control) == Keys.Control)
                {
                    modKey = modKey | HookGlobalHotkey.ModKeys.Ctrl;
                }

                if ((_configs.HotkeyMod & Keys.Shift) == Keys.Shift)
                {
                    modKey = modKey | HookGlobalHotkey.ModKeys.Shift;
                }

                if ((_configs.HotkeyMod & Keys.LWin) == Keys.LWin)
                {
                    modKey = modKey | HookGlobalHotkey.ModKeys.Win;
                }

                _hookGlobalHotkey.RegisterOriginalHotkey(_configs.HotkeyKey, _configs.HotkeyValue, modKey);
            }

            // Twitter用通信クラス初期化
            HttpConnection.InitializeConnection(_configs.DefaultTimeOut, _configs.SelectedProxyType, _configs.ProxyAddress, _configs.ProxyPort, _configs.ProxyUser, _configs.ProxyPassword);

            _tw.SetRestrictFavCheck(_configs.RestrictFavCheck);
            _tw.ReadOwnPost = _configs.ReadOwnPost;
            ShortUrl.IsResolve = _configs.TinyUrlResolve;
            ShortUrl.IsForceResolve = _configs.ShortUrlForceResolve;
            ShortUrl.SetBitlyId(_configs.BitlyUser);
            ShortUrl.SetBitlyKey(_configs.BitlyPwd);
            HttpTwitter.SetTwitterUrl(_cfgCommon.TwitterUrl);
            _tw.TrackWord = _cfgCommon.TrackWord;
            TrackToolStripMenuItem.Checked = !string.IsNullOrEmpty(_tw.TrackWord);
            _tw.AllAtReply = _cfgCommon.AllAtReply;
            AllrepliesToolStripMenuItem.Checked = _tw.AllAtReply;

            Outputz.Key = _configs.OutputzKey;
            Outputz.Enabled = _configs.OutputzEnabled;
            switch (_configs.OutputzUrlmode)
            {
                case OutputzUrlmode.twittercom:
                    Outputz.OutUrl = "http://twitter.com/";
                    break;

                case OutputzUrlmode.twittercomWithUsername:
                    Outputz.OutUrl = "http://twitter.com/" + _tw.Username;
                    break;
            }

            // 画像投稿サービス
            CreatePictureServices();
            SetImageServiceCombo();
            ImageSelectionPanel.Enabled = false;
            ImageServiceCombo.SelectedIndex = _cfgCommon.UseImageService;

            // ウィンドウ設定
            ClientSize = _cfgLocal.FormSize;
            _mySize = _cfgLocal.FormSize;          // サイズ保持(最小化・最大化されたまま終了した場合の対応用)
            _myLoc = _cfgLocal.FormLocation;       // タイトルバー領域
            if (WindowState != FormWindowState.Minimized)
            {
                DesktopLocation = _cfgLocal.FormLocation;
                var tbarRect = new Rectangle(Location, new Size(_mySize.Width, SystemInformation.CaptionHeight));
                bool outOfScreen = true;
                if (Screen.AllScreens.Length == 1)
                {
                    foreach (Screen scr in Screen.AllScreens)
                    {
                        if (!Rectangle.Intersect(tbarRect, scr.Bounds).IsEmpty)
                        {
                            outOfScreen = false;
                            break;
                        }
                    }

                    if (outOfScreen)
                    {
                        DesktopLocation = new Point(0, 0);
                        _myLoc = DesktopLocation;
                    }
                }
            }

            TopMost = _configs.AlwaysTop;
            _mySpDis = _cfgLocal.SplitterDistance;
            _mySpDis2 = _cfgLocal.StatusTextHeight;
            _mySpDis3 = _cfgLocal.PreviewDistance;
            if (_mySpDis3 == -1)
            {
                _mySpDis3 = _mySize.Width - 150;
                if (_mySpDis3 < 1)
                {
                    _mySpDis3 = 50;
                }

                _cfgLocal.PreviewDistance = _mySpDis3;
            }

            _myAdSpDis = _cfgLocal.AdSplitterDistance;
            MultiLineMenuItem.Checked = _cfgLocal.StatusMultiline;
            PlaySoundMenuItem.Checked = _configs.PlaySound;
            PlaySoundFileMenuItem.Checked = _configs.PlaySound;

            // 入力欄
            StatusText.Font = _fntInputFont;
            StatusText.ForeColor = _clrInputForecolor;

            // 全新着通知のチェック状態により、Reply&DMの新着通知有効無効切り替え(タブ別設定にするため削除予定)
            if (!_configs.UnreadManage)
            {
                ReadedStripMenuItem.Enabled = false;
                UnreadStripMenuItem.Enabled = false;
            }

            if (_configs.IsNotifyUseGrowl)
            {
                _growlHelper.RegisterGrowl();
            }

            // タイマー設定
            _timerTimeline.AutoReset = true;
            _timerTimeline.SynchronizingObject = this;

            // Recent取得間隔
            _timerTimeline.Interval = 1000;
            _timerTimeline.Enabled = true;

            // 更新中アイコンアニメーション間隔
            TimerRefreshIcon.Interval = 200;
            TimerRefreshIcon.Enabled = true;

            // 状態表示部の初期化(画面右下)
            StatusLabel.Text = string.Empty;
            StatusLabel.AutoToolTip = false;
            StatusLabel.ToolTipText = string.Empty;

            // 文字カウンタ初期化
            lblLen.Text = GetRestStatusCount(true, false).ToString();

            _statuses.SortOrder = (SortOrder)_cfgCommon.SortOrder;
            IdComparerClass.ComparerMode mode = default(IdComparerClass.ComparerMode);
            switch (_cfgCommon.SortColumn)
            {
                case 0:
                case 5:
                case 6:

                    // 0:アイコン,5:未読マーク,6:プロテクト・フィルターマーク
                    // ソートしない Idソートに読み替え
                    mode = IdComparerClass.ComparerMode.Id;
                    break;

                case 1:

                    // ニックネーム
                    mode = IdComparerClass.ComparerMode.Nickname;
                    break;

                case 2:

                    // 本文
                    mode = IdComparerClass.ComparerMode.Data;
                    break;

                case 3:

                    // 時刻=発言Id
                    mode = IdComparerClass.ComparerMode.Id;
                    break;

                case 4:

                    // 名前
                    mode = IdComparerClass.ComparerMode.Name;
                    break;

                case 7:

                    // Source
                    mode = IdComparerClass.ComparerMode.Source;
                    break;
            }

            _statuses.SortMode = mode;

            switch (_configs.IconSz)
            {
                case IconSizes.IconNone:
                    _iconSz = 0;
                    break;

                case IconSizes.Icon16:
                    _iconSz = 16;
                    break;

                case IconSizes.Icon24:
                    _iconSz = 26;
                    break;

                case IconSizes.Icon48:
                    _iconSz = 48;
                    break;

                case IconSizes.Icon48_2:
                    _iconSz = 48;
                    _iconCol = true;
                    break;
            }

            if (_iconSz == 0)
            {
                _tw.SetGetIcon(false);
            }
            else
            {
                _tw.SetGetIcon(true);
                _tw.SetIconSize(_iconSz);
            }

            _tw.SetTinyUrlResolve(_configs.TinyUrlResolve);
            ShortUrl.IsForceResolve = _configs.ShortUrlForceResolve;

            _tw.DetailIcon = _iconDict;
            StatusLabel.Text = R.Form1_LoadText1;  // 画面右下の状態表示を変更
            StatusLabelUrl.Text = string.Empty;  // 画面左下のリンク先URL表示部を初期化
            NameLabel.Text = string.Empty;       // 発言詳細部名前ラベル初期化
            DateTimeLabel.Text = string.Empty;   // 発言詳細部日時ラベル初期化
            SourceLinkLabel.Text = string.Empty; // Source部分初期化

            // <<<<<<<<タブ関連>>>>>>>
            // デフォルトタブの存在チェック、ない場合には追加
            if (_statuses.GetTabByType(TabUsageType.Home) == null)
            {
                if (!_statuses.Tabs.ContainsKey(MyCommon.DEFAULTTAB.RECENT))
                {
                    _statuses.AddTab(MyCommon.DEFAULTTAB.RECENT, TabUsageType.Home, null);
                }
                else
                {
                    _statuses.Tabs[MyCommon.DEFAULTTAB.RECENT].TabType = TabUsageType.Home;
                }
            }

            if (_statuses.GetTabByType(TabUsageType.Mentions) == null)
            {
                if (!_statuses.Tabs.ContainsKey(MyCommon.DEFAULTTAB.REPLY))
                {
                    _statuses.AddTab(MyCommon.DEFAULTTAB.REPLY, TabUsageType.Mentions, null);
                }
                else
                {
                    _statuses.Tabs[MyCommon.DEFAULTTAB.REPLY].TabType = TabUsageType.Mentions;
                }
            }

            if (_statuses.GetTabByType(TabUsageType.DirectMessage) == null)
            {
                if (!_statuses.Tabs.ContainsKey(MyCommon.DEFAULTTAB.DM))
                {
                    _statuses.AddTab(MyCommon.DEFAULTTAB.DM, TabUsageType.DirectMessage, null);
                }
                else
                {
                    _statuses.Tabs[MyCommon.DEFAULTTAB.DM].TabType = TabUsageType.DirectMessage;
                }
            }

            if (_statuses.GetTabByType(TabUsageType.Favorites) == null)
            {
                if (!_statuses.Tabs.ContainsKey(MyCommon.DEFAULTTAB.FAV))
                {
                    _statuses.AddTab(MyCommon.DEFAULTTAB.FAV, TabUsageType.Favorites, null);
                }
                else
                {
                    _statuses.Tabs[MyCommon.DEFAULTTAB.FAV].TabType = TabUsageType.Favorites;
                }
            }

            foreach (string tn in _statuses.Tabs.Keys)
            {
                if (_statuses.Tabs[tn].TabType == TabUsageType.Undefined)
                {
                    _statuses.Tabs[tn].TabType = TabUsageType.UserDefined;
                }

                if (!AddNewTab(tn, true, _statuses.Tabs[tn].TabType, _statuses.Tabs[tn].ListInfo))
                {
                    throw new Exception(R.TweenMain_LoadText1);
                }
            }

            JumpReadOpMenuItem.ShortcutKeyDisplayString = "Space";
            CopySTOTMenuItem.ShortcutKeyDisplayString = "Ctrl+C";
            CopyURLMenuItem.ShortcutKeyDisplayString = "Ctrl+Shift+C";
            CopyUserIdStripMenuItem.ShortcutKeyDisplayString = "Shift+Alt+C";

            if (!_configs.MinimizeToTray || WindowState != FormWindowState.Minimized)
            {
                Visible = true;
            }

            _curTab = ListTab.SelectedTab;
            _curItemIndex = -1;
            _curList = (DetailsListView)_curTab.Tag;
            SetMainWindowTitle();
            SetNotifyIconText();

            if (_configs.TabIconDisp)
            {
                ListTab.DrawMode = TabDrawMode.Normal;
            }
            else
            {
                ListTab.DrawMode = TabDrawMode.OwnerDrawFixed;
                ListTab.DrawItem += ListTab_DrawItem;
                ListTab.ImageList = null;
            }

            SplitContainer4.Panel2Collapsed = true;
            _ignoreConfigSave = false;
            ResizeMainForm();
            if (saveRequired)
            {
                SaveConfigsAll(false);
            }

            if (_tw.UserId == 0)
            {
                _tw.VerifyCredentials();
                foreach (var ua in _cfgCommon.UserAccounts)
                {
                    if (ua.Username.ToLower() == _tw.Username.ToLower())
                    {
                        ua.UserId = _tw.UserId;
                        break;
                    }
                }
            }

            foreach (var ua in _configs.UserAccounts)
            {
                if (ua.UserId == 0 && ua.Username.ToLower() == _tw.Username.ToLower())
                {
                    ua.UserId = _tw.UserId;
                    break;
                }
            }
        }
        private void listBoxResultDataSets_SelectedIndexChanged(object sender, EventArgs e)
        {
            listBoxUserResults.ClearSelected();
            listBoxUserResults.Items.Clear();
            onEvaluationRangeChanged(-1, -1);
            OpenNIRecordingController source = (videoDataSource.Source as OpenNIRecordingController);
            if (source != null)
            {
                source.AdditionalSkeletonInformation = null;
                source.AdditionalSkeletonIDs.Clear();
                source.RequestUpdate(true);
            }

            if (listBoxResultDataSets.SelectedItem == null)
            {
                listBoxUserResults.Enabled = false;
            }
            else
            {
                String resultfilename = Path.Combine(current_take_dir.FullName, (String)listBoxResultDataSets.SelectedItem);
                try
                {
                    using (FileStream file = File.Open(resultfilename, FileMode.Open))
                    {
                        resultDictionary = (ImageDictionary)movementDataSerializer.Deserialize(file);
                    }
                    Dictionary<int, int> userActivities = resultDictionary.GetUserStatistics(null);
                    foreach (int userID in userActivities.Keys)
                    {
                        listBoxUserResults.Items.Add("User " + userID);
                    }

                    if (source != null)
                    {
                        source.AdditionalSkeletonInformation = resultDictionary;
                        onEvaluationRangeChanged(resultDictionary.Keys.Min(),
                                                    resultDictionary.Keys.Max());
                    }

                    listBoxUserResults.Enabled = true;
                }
                catch (Exception ex)
                {
                    listBoxUserResults.ClearSelected();
                    listBoxUserResults.Items.Clear();
                    listBoxUserResults.Enabled = false;
                    MessageBox.Show(this,
                        "An Error occured loading the results file:\n" + ex.Message,
                        "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        /// <summary>
        /// Creates a new control instance with a recording as data
        /// source. The current image data can be obtained by the
        /// <see cref="Image"/>-property. The
        /// <see cref="NewImageDataAvailable"/> event informs about when the
        /// data is updated, the <see cref="ErrorOccured"/>-event about
        /// errors.
        /// </summary>
        /// <exception cref="System.Exception">Thrown if the stream could not
        /// be initialized properly.</exception>
        public OpenNIRecordingController(String recording_filename,
            String movementDataFileName, String userAnnotationFilename)
        {
            // Create a new context and the data-generating nodes.
            context = new Context();
            context.OpenFileRecording(recording_filename);
            this.recording_filename = recording_filename;

            _userInformationReader = new BinaryReader(
                       new FileStream(movementDataFileName, FileMode.Open));

            using (FileStream annotation_stream = File.OpenRead(userAnnotationFilename))
            {
                _userLocationInformation = (ImageDictionary)movementDataSerializer.Deserialize(annotation_stream);
            }

            // Image
            imageGenerator = (ImageGenerator)context.FindExistingNode(NodeType.Image);

            // Depth
            depthGenerator = (DepthGenerator)context.FindExistingNode(NodeType.Depth);
            histogram = new int[depthGenerator.DeviceMaxDepth];

            // Player
            player = (Player)context.FindExistingNode(NodeType.Player);
            player.PlaybackSpeed = 1.0;

            if (depthGenerator == null || imageGenerator == null || player == null)
            {
                throw new Exception("Could not initialize recording stream.");
            }

            // Error handling
            context.ErrorStateChanged += context_ErrorStateChanged;
            context.StartGeneratingAll();
        }
        /// <summary>
        /// The export logic.
        /// </summary>
        /// <param name="parameter">An object[] with the real parameters.
        /// Have a look at <see cref="ExportFrames"/> for a usage
        /// example.</param>
        private void doExport(object parameter)
        {
            object[] parameters = parameter as object[];
            if (parameters == null)
                return;

            // Export directory
            DirectoryInfo exportDir = parameters[10] as DirectoryInfo;
            if (exportDir == null) return;

            // Frame list
            List<int> frames = parameters[0] as List<int>;
            if (frames == null || frames.Count == 0)
                return;
            frames.Sort();

            // User list
            List<int> userIDs = parameters[1] as List<int>;
            if (userIDs == null)
                return;

            // Ignore List
            List<int> formerIgnoreList = new List<int>(UsersToIgnore);
            UsersToIgnore.Clear();
            List<int> occuringUsers = GetUserStatistics(frames).Keys.ToList<int>();
            foreach (int user in occuringUsers)
            {
                if (!userIDs.Contains(user))
                {
                    UsersToIgnore.Add(user);
                }
            }

            // The rest of parameters
            bool AnnotationsIn2D = (bool)parameters[2];
            bool AnnotationsIn3D = (bool)parameters[3];
            bool ExportRelativePathNames = (bool)parameters[4];
            bool ImageOrDepth = (bool)parameters[5];
            bool DrawBackground = (bool)parameters[6];
            bool DrawSkeleton = (bool)parameters[7];
            bool DrawHighlights = (bool)parameters[8];
            bool DrawLabels = (bool)parameters[9];

            // Number format
            int max = frames[frames.Count - 1];
            int characters;
            if (max == 0)
                characters = 1;
            else
                characters = (int)Math.Ceiling(Math.Log10(max));
            String exportFormatString = "d" + characters;

            // The export xml files.
            ImageDictionary exportedIndex2D = new ImageDictionary(false);
            exportedIndex2D.XmlExportFrameFileList = new Dictionary<int, string>();
            exportedIndex2D.XmlOmitPoints = (userIDs.Count == 0);

            ImageDictionary exportedIndex3D = new ImageDictionary(true);
            exportedIndex3D.XmlExportFrameFileList = new Dictionary<int, string>();
            exportedIndex3D.XmlOmitPoints = (userIDs.Count == 0);

            String filename;
            String export_filename_suffix = "";
            lock (RUN_CONTROL_LOCK)
            {
                try
                {
                    StopPlayback();

                    lock (EXPORT_LOCK)
                    {
                        // Configure for export
                        DrawSkeletonMesh = DrawSkeleton;
                        DrawSensorData = true;
                        this.ImageOrDepth = ImageOrDepth;
                        this.DrawBackground = DrawBackground;
                        this.DrawUserHighlight = DrawHighlights;
                        this.DrawUserInformation = DrawLabels;

                        if (DrawSkeleton) export_filename_suffix += "s";
                        if (!DrawSensorData) export_filename_suffix += "a";
                        if (!ImageOrDepth) export_filename_suffix += "d";
                        if (!DrawBackground) export_filename_suffix += "b";
                        if (DrawUserHighlight) export_filename_suffix += "h";
                        if (DrawUserInformation) export_filename_suffix += "l";

                        if (export_filename_suffix.Length > 0)
                            export_filename_suffix = "-" + export_filename_suffix;

                        for (int frameIndex = 0; frameIndex < frames.Count; frameIndex++)
                        {
                            SeekFrame(frames[frameIndex]);
                            RequestUpdate(false);
                            String relative_filename = frames[frameIndex].ToString(exportFormatString) +
                                                        export_filename_suffix + ".png";
                            filename = Path.Combine(exportDir.FullName,
                                                    relative_filename);

                            lock (ImageLock)
                            {
                                bitmap.Save(filename, ImageFormat.Png);
                            }

                            // Get the user positions in this frame
                            Dictionary<int, JointDictionary> frame_positions2D =
                                new Dictionary<int,JointDictionary>();
                            Dictionary<int, JointDictionary> frame_positions3D =
                                new Dictionary<int, JointDictionary>();
                            if (UserLocationInformation.ContainsKey(frames[frameIndex]))
                            {
                                foreach (int user in UserLocationInformation[frames[frameIndex]].Keys)
                                {
                                    if (userIDs.Contains(user))
                                    {
                                        frame_positions3D.Add(user, new JointDictionary(
                                            UserLocationInformation[frames[frameIndex]][user]));
                                        frame_positions2D.Add(user, new JointDictionary(
                                            Convert3Dto2D(UserLocationInformation[frames[frameIndex]][user], depthGenerator)));
                                    }
                                }
                            }
                            exportedIndex2D.Add(frames[frameIndex], frame_positions2D);
                            if (!ExportRelativePathNames)
                            {
                                exportedIndex2D.XmlExportFrameFileList.Add(
                                    frames[frameIndex], filename);
                            }
                            else
                            {
                                exportedIndex2D.XmlExportFrameFileList.Add(
                                    frames[frameIndex], relative_filename);
                            }
                            exportedIndex3D.Add(frames[frameIndex], frame_positions3D);
                            if (!ExportRelativePathNames)
                            {
                                exportedIndex3D.XmlExportFrameFileList.Add(
                                    frames[frameIndex], filename);
                            }
                            else
                            {
                                exportedIndex3D.XmlExportFrameFileList.Add(
                                    frames[frameIndex], relative_filename);
                            }

                            onExportMadeProgress(
                                (float)(frameIndex + 1) / (float)frames.Count * 100, frameIndex + 1, frames.Count);
                            if (export_cancelled)
                                return;
                        }
                    }
                }
                catch (Exception e)
                {
                    onExportFailed(e.Message);
                    return;
                }

                // Reset ignore list
                UsersToIgnore.Clear();
                UsersToIgnore.AddRange(formerIgnoreList);

                if (!AnnotationsIn2D) exportedIndex2D = null;
                if (!AnnotationsIn3D) exportedIndex3D = null;
            }

            // Report success.
            Thread reporter = new Thread(onExportFinished);
            reporter.Start(new object[]{this, exportDir, frames, userIDs,
                    exportedIndex2D, exportedIndex3D, ExportRelativePathNames,
                    export_filename_suffix});
        }
Пример #13
0
 /// <inheritdoc />
 public override string ToString()
 {
     return(ImageDictionary.ToString());
 }